cnavarro wrote:Al escribir un mensaje, pulsa sobre el boton CODE y pega el "fuente" entre los dos code y /code que te aparece
STATIC FUNCTION AjusteBodega()
local cSql
TEXT INTO cSql
UPDATE exi_suc A
LEFT OUTER JOIN (
SELECT exi_art,
SUM(exi_ent) AS entrada,
SUM(exi_sal) AS salia
FROM exi_det
GROUP BY exi_art
) B
ON A.ma_arti = B.exi_art
SET A.bod_ent1 = IFNULL( B.entrada, 0 ),
A.bod_sal1 = IFNULL( B.salia, 0 ),
A.bod_ini1 = 0
WHERE A.sto_ok = 1
ENDTEXT
CursorWait()
oConexion:Execute( cSql )
CursorArrow()
return nil
nageswaragunupudi wrote:Mr jbrita
All this can be done by executing one single SQL statement.
- Code: Select all Expand view
STATIC FUNCTION AjusteBodega()
local cSql
TEXT INTO cSql
UPDATE exi_suc A
LEFT OUTER JOIN (
SELECT exi_art,
SUM(exi_ent) AS entrada,
SUM(exi_sal) AS salia
FROM exi_det
GROUP BY exi_art
) B
ON A.ma_arti = B.exi_art
SET A.bod_ent1 = IFNULL( B.entrada, 0 ),
A.bod_sal1 = IFNULL( B.salia, 0 ),
A.bod_ini1 = 0
WHERE A.sto_ok = 1
ENDTEXT
CursorWait()
oConexion:Execute( cSql )
CursorArrow()
return nil
This SQL syntax is for MySql. For others this may be different.
You can use ADO or TDolphin or any other library, this SQL syntax works.
You do not need progress meter because the execution is extremely fast.
Please check for any spelling mistakes before executing the above code
nageswaragunupudi wrote:I just answered mr jbrita's requirement.
If you are talking about accounting systems, there are a lot of better ways to do.
We can straightaway get account summary ( some countries call it trial balance) with group totals and all in one stroke.
Then super-impose closing entries and display balance-sheet and profit and loss account.
I suggest you post a specific requirement in a separate thread and we see how simple the entire process can be.
Return to FiveWin para Harbour/xHarbour
Users browsing this forum: Google [Bot], JoseAlvarez, karinha, Willi Quintana and 73 guests