Inventory Reservation On Call
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
[FormControlEventHandler(formControlStr(SalesTable, SalesTable_DOMIgnore), FormControlEventType::Modified)]
public static void SalesTable_DOMIgnore_OnModified(FormControl sender, FormControlEventArgs e)
{
SalesLine salesLineBuf;
FormRun form = sender.formRun();
FormDataSource salesTable_ds = form.dataSource(formDataSourceStr(SalesTable, SalesTable)) as FormDataSource;
SalesTable salesTable = salesTable_ds.cursor();
if(salesTable.DOMIgnore == NoYes::Yes)
{
while select salesLineBuf where salesLineBuf.SalesId == salesTable.SalesId
{
InventUpd_Reservation reservation;
InventMovement movement = InventMovement::construct(salesLineBuf);
InventQty reserveQuantity = salesLineBuf.QtyOrdered - abs(movement.transIdSum().reserved());
info(strFmt("%1", reserveQuantity));
if (reserveQuantity > 0)
{
reservation = InventUpd_Reservation::newMovement(
movement,
-reserveQuantity,true );
reservation.updateNow();
}
}
}
}
No comments:
Post a Comment