The filldata on FillInData pData Global gRecargo Global gTaxes put glxapp_getPref ("decimals_price") into tDecimals_Price put glxapp_getPref ("decimals_unit") into tDecimals_Unit try set the numberFormat to tDecimals_Price -- dollar format -- This message is sent when the Data Grid needs to populate -- this template with the column data. pData is the value to be displayed. set the text of me to pData --set the unicodetext of me to uniencode(pData,"utf8") SetForegroundColor switch the dgColumn of me case "NAME" --find fld f_buscar --truncatetail the short id of me, "..." set the dontwrap of me to false break case "UNITS" if isnumber(pData) then put GetDataOfIndex (the dgIndex of me, "PRICE") into tPrecioCoste put GetDataOfIndex (the dgIndex of me, "UNITS") into tUnidades put GetDataOfIndex (the dgIndex of me, "REDUCTION_PERCENT_1") into tDto1 put GetDataOfIndex (the dgIndex of me, "REDUCTION_PERCENT_2") into tDto2 replace comma with "." in tPrecioCoste replace comma with "." in tUnidades replace comma with "." in tDto1 replace comma with "." in tDto2 put tUnidades * tPrecioCoste into tTotal put tDto1 / 100 into tDto1 put tTotal * tDto1 into tDtoTotal put tTotal - tDtoTotal into tTotal --replace "." with comma in tTotal SetDataOfIndex the dgIndex of me, "AMOUNT_LINE", tTotal --& " €" end if break end switch [... calculations ...] catch e answer e end try end FillInData
The CloseFieldEditor on CloseFieldEditor pFieldEditor Global gTaxes Global tCliente Global gDocType put glxapp_getPref ("decimals_price") into tDecimals_Price put glxapp_getPref ("decimals_unit") into tDecimals_Unit --set the numberFormat to tDecimals_Price --"#.00" -- euro format ## save the data to dgData array before upating aggregate fields switch the dgColumn of me case "CODE" put the text of pFieldEditor into tCode --answer tCode put _GetProduct (tCode) into tArrayA printkeys tArrayA ## Begin Control numeros de serie --answer tArrayA["NEEDSSERIALNUMBER"] --if tArrayA["NEEDSSERIALNUMBER"] is not empty then --answer "Capturar numero serie" as sheet --else --answer "Else" as sheet --end if ## End Control numeros de serie if gDocType is 8 or gDocType is 9 then ## Aplicar precio compra producto if isnumber(tArrayA[1]["PRICE_WHOLESALE"]) then set the numberFormat to tDecimals_Price replace "," with "." in tArrayA[1]["PRICE_WHOLESALE"] put tArrayA[1]["PRICE_WHOLESALE"] into tPrice if tPrice is not empty then put tArrayA[1]["PRICE"] into tPrecioTarifa multiply tPrecioTarifa by 1 end if else put 0 into tPrecioTarifa end if else ## Aplicar precio venta producto ## Aplicar precio tarifa por cliente put DESC & tCliente["CLI_ID_PRICELIST"] into tTarifa if isnumber(tArrayA[1]["PRICE"]) then set the numberFormat to tDecimals_Price replace "," with "." in tArrayA[1]["PRICE"] put tArrayA[1]["PRICE"] into tPrice if tPrice is not empty then replace "," with "." in tArrayA[1][tTarifa] put tArrayA[1][tTarifa] into tPercent if tPrecent is not 0 then multiply tPrice by tPercent divide tPrice by 100 put tArrayA[1]["PRICE"]-tPrice into tPrecioTarifa multiply tPrecioTarifa by 1 else put tArrayA[1]["PRICE"] into tPrecioTarifa multiply tPrecioTarifa by 1 end if end if else put 0 into tPrecioTarifa end if end if if gDocType is 8 or gDocType is 9 then ## Poner valores en la datagrid SetDataOfIndex the dgIndex of me, "NAME", "(" & tArrayA[1]["SUPPLIER_REFERENCE"] & ") " & tArrayA[1]["NAME"] else ## Poner valores en la datagrid SetDataOfIndex the dgIndex of me, "NAME", tArrayA[1]["NAME"] end if SetDataOfIndex the dgIndex of me, "PRICE", tPrecioTarifa put gTaxes[tArrayA[1]["ID_TAX"]]["VALOR"] into tValorIVA SetDataOfIndex the dgIndex of me, "ID_TAX", tValorIVA set the text of pFieldEditor to tCode break case "UNITS" set the numberFormat to tDecimals_Unit put the text of pFieldEditor into tValue replace "," with "." in tValue set the text of pFieldEditor to tValue+0 break case "PRICE" set the numberFormat to tDecimals_Price -- dollar format put the text of pFieldEditor into tValue replace "," with "." in tValue set the text of pFieldEditor to tValue+0 break case "REDUCTION_PERCENT_1" put the text of pFieldEditor into tValue replace "," with "." in tValue set the text of pFieldEditor to tValue+0 break case "DAYS" set the numberFormat to tDecimals_Unit put the text of pFieldEditor into tValue replace "," with "." in tValue set the text of pFieldEditor to tValue+0 break case "DIMENSION3" set the numberFormat to tDecimals_Unit put the text of pFieldEditor into tValue replace "," with "." in tValue set the text of pFieldEditor to tValue+0 break case "DIMENSION4" set the numberFormat to tDecimals_Unit put the text of pFieldEditor into tValue replace "," with "." in tValue set the text of pFieldEditor to tValue+0 break case "ADUANA" set the numberFormat to tDecimals_Price put the text of pFieldEditor into tValue replace "," with "." in tValue set the text of pFieldEditor to tValue+0 break default put the text of pFieldEditor into tValue break end switch SetDataOfIndex the dgIndex of me, the dgColumn of me, the text of pFieldEditor end CloseFieldEditor -- View this message in context: http://runtime-revolution.278305.n4.nabble.com/datagrid-rows-disapear-when-add-new-row-tp3251346p3252893.html Sent from the Revolution - User mailing list archive at Nabble.com. _______________________________________________ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode