Jacopo
Script Calcolo dell'Utile
salve, ho una domanda in merito a questo script:
Option Explicit
Dim Quantita, PrezzoFIFO, TotaleLinea
Dim IdComposizione, RigaComposizione, TotCosto, RigaDoc
Dim TotaleMargine
TotaleMargine=0
For Each RigaDoc In Doc.Rows
IdComposizione=Rdy.toLong(RigaDoc.CustomField(190))
If IdComposizione>0 Then
If Ucase(RigaDoc.CustomField(5))="TESTA COMPOSIZIONE" Then
TotCosto = 0
For Each RigaComposizione In RigaDoc.Doc.DocRows
If Rdy.toLong(RigaComposizione.CustomField(190))=IdComposizione Then
If Ucase(RigaComposizione.CustomField(5))<>"TESTA COMPOSIZIONE" Then
Quantita = RigaComposizione.Quantity
PrezzoFIFO = RigaComposizione.Product.InventoryValueFIFO
TotCosto = TotCosto+Quantita*PrezzoFIFO
End If
End If
Next
TotaleLinea = Rdy.toDouble(RigaDoc.CustomField(61))
TotaleMargine = TotaleMargine + (TotaleLinea-TotCosto)
End If
Else
' Riga standard
Quantita = RigaDoc.Quantity
PrezzoFIFO = RigaDoc.Product.InventoryValueFIFO
TotaleLinea = Rdy.toDouble(RigaDoc.CustomField(61))
TotaleMargine = TotaleMargine + (TotaleLinea-PrezzoFIFO*Quantita)
End If
Next
Response.Write(Rdy.FormatCurrency(TotaleMargine))
Se io volessi sostituire Product.InventoryValueFIFO con il prezzo d'acquisto fornitore primario che sarebbe se non erro Product.CustomField(60) saprebbe indicarmi come va inserito nello script sopra menzionato?
|