Edit Qty editMCGPalletTotal(boolean _set , Qty _Qty)
{
Qty palletQty,salesQty,totalQty,Qty;
SalesTable SalesTableLoc;
SalesLine SalesLine;
;
if(_set)
{
ttsbegin;
SalesTableLoc = SalesTable::find(this.SalesId,true);
SalesTableLoc.MCGPalletQty = _Qty;
SalesTableLoc.update();
ttscommit;
Qty = SalesTableLoc.MCGPalletQty;
return Qty;
}
else
{
this.reread();
if (!this.MCGPalletQty)
{
while select SalesId,ItemId,SalesQty from SalesLine where SalesLine.SalesId == this.SalesId
{
palletQty = InventTable::find(SalesLine.ItemId).standardPalletQuantity;
salesQty = SalesLine.SalesQty;
totalQty = totalQty + palletQty * salesQty;
Qty = totalQty;
}
}
else
{
Qty = this.MCGPalletQty;
}
return Qty;
}
}