since I don't have much time to devote to family problems,
I'm trying to modify yunus.prg to make it viable in Italy,
I will probably have countless problems but i want to try if i can use yunus.prg for my friend
I added tax fields because here in Italy we can have a different VAT for each item.
1. I added the tax for each item (items.dbf)
2. I added the tax in the body of the invoice (invitems.dbf)
when I go to create an order it makes the wrong calculation ie as you can see in this figure
the Net column should be 6 but 4.7595 that is rounded 4.76 where does the calculation of the Net column do?
for a sample :
Price 25.05
TAX %: 19%
Price without Tax: 25.05
Price with tax: 29.81 ( amount)
Tax import: 4.76
How i can to implement this on yunus ?
I modified on function EditInvoice( oRec )
I add this line before the xbrowse
- Code: Select all Expand view
- bCalcRow := { || (TotalRow(oBrw), oBrw:RefreshFooters(), oDlg:Update() )}
- Code: Select all Expand view
for each cCol in { "qty", "price", "discount","tax" }
WITH OBJECT oBrw:oCol( cCol )
:nEditType := EDIT_GET
:bEditValid := { |o| o:VarGet() >= 0 }
* :bOnChange := { || oBrw:MakeTotals( { "amount", "net" } ), oBrw:RefreshFooters(), oDlg:Update() }
:bOnChange := bCalcRow
END
next
I add this function to cal the total of row
- Code: Select all Expand view
- static function TotalRow(oBrw)
local nPriceUnit := oBrw:aCols[ 5 ]:Value
local nQuantity := oBrw:aCols[ 3 ]:Value
local ntax := oBrw:aCols[ 7 ]:Value
local ndescount := oBrw:aCols[ 8 ]:Value
local nTotalRow := 0
local nTotalTax := 0
nTotalRow := nPriceUnit * nQuantity
nTotalTax := (nTotalRow*100)/ntax
If ndescount >0
nTotalRow := nTotalRow - ndescount
Endif
oBrw:aCols[6]:VarPut(nTotalRow)
oBrw:aCols[9]:VarPut(nTotalTax)
return nil
But not run !!!
thanks