void clicked()
{
dialogButton dialogCheckMessage;
;
dialogCheckMessage
= Box::okCancel(SalesParmTable.SalesId,dialogButton::Cancel,"ตรวจสอบข้อมูล");
if(dialogCheckMessage == dialogButton::Ok)
{
info("OK");
super();
}
else
{
info("Cancle");
return;
}
}
=================================================================
void clicked()
{
//vbs begin
SalesParmLine _SalesParmLineforCancle;
CustConfirmJour CustConfirmJour;
CustConfirmTrans CustConfirmTrans;
// Pantep Cus1
dialogButton dialogCheckBeforePost;
// End Cus1
;
// Pantep Cus1.2
dialogCheckBeforePost = Box::okCancel(strfmt("%1 \n %2",SalesParmTable.VBS_ReservedInvoice,SalesParmTable.Transdate),DialogButton::No,"Check before Post");
if(dialogCheckBeforePost == DialogButton::Ok)
{
// End Cus1.2
if(updateNow.value())
{
if(element.vbs_checkMultipleAccount())
{
error("Can not post multiple customer account");
return;
}
switch (documentStatus)
{
case documentStatus::Confirmation:
if(!SalesparmTable.VBS_ReservedInvoice)
{
while select _SalesParmLineforCancle where _SalesParmLineforCancle.ParmId == SalesparmTable.ParmId
{
//info(strfmt("%1",_SalesParmLineforCancle.DeliverNow));
if(_SalesParmLineforCancle.DeliverNow < 0)
{
error("Please select reserved invoice to cancle");
return;
}
}
}
else
{
while select _SalesParmLineforCancle where _SalesParmLineforCancle.ParmId == SalesparmTable.ParmId
{
//info(strfmt("%1",_SalesParmLineforCancle.DeliverNow));
if(_SalesParmLineforCancle.DeliverNow < 0)
{
select forupdate CustConfirmJour where CustConfirmJour.VBS_ReservedInvoice == SalesparmTable.VBS_ReservedInvoice
&& CustConfirmJour.VBS_Cancel == NoYes::No;
if(CustConfirmJour)
{
ttsbegin;
CustConfirmJour.VBS_Cancel = NoYes::Yes;
CustConfirmJour.update();
ttscommit;
}
element.close();
info(strfmt("Invoice %1 has been cancled",SalesparmTable.VBS_ReservedInvoice));
}
else
{
select forupdate CustConfirmJour where CustConfirmJour.VBS_ReservedInvoice == SalesparmTable.VBS_ReservedInvoice
&& CustConfirmJour.VBS_Cancel == NoYes::No;
if(CustConfirmJour)
{
ttsbegin;
CustConfirmJour.VBS_ReservedInvoice = "";
CustConfirmJour.update();
ttscommit;
}
}
}
}
break;
case documentStatus::PickingList:
if(!SalesparmTable.VBS_ReservedInvoice)
{
if(!element.vbs_checkPickingList())
{
error("Please select reserved invoice");
return;
}
}
break;
case documentStatus::PackingSlip:
if(!SalesparmTable.VBS_ReservedInvoice)
{
if(!element.vbs_checkPackingSlip() && _SalesParmLineforCancle.DeliverNow < 0)
{
error("Please select reserved invoice");
return;
}
}
break;
}
}
//vbs end
super();
// Pantep Cus1.5
}
else
{
return;
}
//End Cus1.5
}
==================================================================
display real dispPrice()
{
real rqty, rvalue;
SysClientSessions scs;
str strUserID, strCompName;
;
//Get Client
select * from scs where scs.clientComputer == WinAPI::getComputerName();
strUserID = scs.userId;
//
rqty = this.quantitySum();
rvalue = this.valueSum();
if(rqty == 0)
{
rPrice = 0;
}else
{
if(strUserID == "Audit"||strUserID == "Audi1"||strUserID == "Audi2"||strUserID == "Audi3"||
strUserID == "Audi4"||strUserID == "Audi5"||strUserID == "Admin"||strUserID == "com_c"||
strUserID == "Comp1"||strUserID == "compu")
{
rPrice = rvalue/rqty;
}else
rPrice = 0;
//rPrice = rvalue/rqty;
}
return rPrice;
}
================================================
void clicked()
{
//vbs begin
SalesParmLine _SalesParmLineforCancle;
CustConfirmJour CustConfirmJour;
CustConfirmTrans CustConfirmTrans;
// Pantep Cus1
dialogButton dialogCheckBeforePost;
// End Cus1
SysClientSessions scs;
str strUserID;
;
select * from scs where scs.clientComputer == WinAPI::getComputerName();
strUserID = scs.userId;
if(strUserID== "Trad4")
{
// INTERNAL BEGIN
// Pantep Cus1.2
dialogCheckBeforePost = Box::okCancel(strfmt("%1 \n %2",SalesParmTable.VBS_ReservedInvoice,SalesParmTable.Transdate),DialogButton::No,"Check before Post");
if(dialogCheckBeforePost == DialogButton::Ok)
{
// End Cus1.2
if(updateNow.value())
{
if(element.vbs_checkMultipleAccount())
{
error("Can not post multiple customer account");
return;
}
switch (documentStatus)
{
case documentStatus::Confirmation:
if(!SalesparmTable.VBS_ReservedInvoice)
{
while select _SalesParmLineforCancle where _SalesParmLineforCancle.ParmId == SalesparmTable.ParmId
{
//info(strfmt("%1",_SalesParmLineforCancle.DeliverNow));
if(_SalesParmLineforCancle.DeliverNow < 0)
{
error("Please select reserved invoice to cancle");
return;
}
}
}
else
{
while select _SalesParmLineforCancle where _SalesParmLineforCancle.ParmId == SalesparmTable.ParmId
{
//info(strfmt("%1",_SalesParmLineforCancle.DeliverNow));
if(_SalesParmLineforCancle.DeliverNow < 0)
{
select forupdate CustConfirmJour where CustConfirmJour.VBS_ReservedInvoice == SalesparmTable.VBS_ReservedInvoice
&& CustConfirmJour.VBS_Cancel == NoYes::No;
if(CustConfirmJour)
{
ttsbegin;
CustConfirmJour.VBS_Cancel = NoYes::Yes;
CustConfirmJour.update();
ttscommit;
}
element.close();
info(strfmt("Invoice %1 has been cancled",SalesparmTable.VBS_ReservedInvoice));
}
else
{
select forupdate CustConfirmJour where CustConfirmJour.VBS_ReservedInvoice == SalesparmTable.VBS_ReservedInvoice
&& CustConfirmJour.VBS_Cancel == NoYes::No;
if(CustConfirmJour)
{
ttsbegin;
CustConfirmJour.VBS_ReservedInvoice = "";
CustConfirmJour.update();
ttscommit;
}
}
}
}
break;
case documentStatus::PickingList:
if(!SalesparmTable.VBS_ReservedInvoice)
{
if(!element.vbs_checkPickingList())
{
error("Please select reserved invoice");
return;
}
}
break;
case documentStatus::PackingSlip:
if(!SalesparmTable.VBS_ReservedInvoice)
{
if(!element.vbs_checkPackingSlip() && _SalesParmLineforCancle.DeliverNow < 0)
{
error("Please select reserved invoice");
return;
}
}
break;
}
}
//vbs end
super();
// Pantep Cus1.5
}
else
{
return;
}
//End Cus1.5
//INTERNAL END
}
else
{
info("external");
if(updateNow.value())
{
if(element.vbs_checkMultipleAccount())
{
error("Can not post multiple customer account");
return;
}
switch (documentStatus)
{
case documentStatus::Confirmation:
if(!SalesparmTable.VBS_ReservedInvoice)
{
while select _SalesParmLineforCancle where _SalesParmLineforCancle.ParmId == SalesparmTable.ParmId
{
//info(strfmt("%1",_SalesParmLineforCancle.DeliverNow));
if(_SalesParmLineforCancle.DeliverNow < 0)
{
error("Please select reserved invoice to cancle");
return;
}
}
}
else
{
while select _SalesParmLineforCancle where _SalesParmLineforCancle.ParmId == SalesparmTable.ParmId
{
//info(strfmt("%1",_SalesParmLineforCancle.DeliverNow));
if(_SalesParmLineforCancle.DeliverNow < 0)
{
select forupdate CustConfirmJour where CustConfirmJour.VBS_ReservedInvoice == SalesparmTable.VBS_ReservedInvoice
&& CustConfirmJour.VBS_Cancel == NoYes::No;
if(CustConfirmJour)
{
ttsbegin;
CustConfirmJour.VBS_Cancel = NoYes::Yes;
CustConfirmJour.update();
ttscommit;
}
element.close();
info(strfmt("Invoice %1 has been cancled",SalesparmTable.VBS_ReservedInvoice));
}
else
{
select forupdate CustConfirmJour where CustConfirmJour.VBS_ReservedInvoice == SalesparmTable.VBS_ReservedInvoice
&& CustConfirmJour.VBS_Cancel == NoYes::No;
if(CustConfirmJour)
{
ttsbegin;
CustConfirmJour.VBS_ReservedInvoice = "";
CustConfirmJour.update();
ttscommit;
}
}
}
}
break;
case documentStatus::PickingList:
if(!SalesparmTable.VBS_ReservedInvoice)
{
if(!element.vbs_checkPickingList())
{
error("Please select reserved invoice");
return;
}
}
break;
case documentStatus::PackingSlip:
if(!SalesparmTable.VBS_ReservedInvoice)
{
if(!element.vbs_checkPackingSlip() && _SalesParmLineforCancle.DeliverNow < 0)
{
error("Please select reserved invoice");
return;
}
}
break;
}
}
//vbs end
super();
}
}
==============================================
void clicked()
{
//vbs begin
SalesParmLine _SalesParmLineforCancle;
CustConfirmJour CustConfirmJour;
CustConfirmTrans CustConfirmTrans;
// Pantep Cus1
dialogButton dialogCheckBeforePost;
// End Cus1
SysClientSessions scs;
str strUserID;
;
select * from scs where scs.clientComputer == WinAPI::getComputerName();
// strUserID = scs.userId;
strUserID = curuserId();
//print strUserID;
//pause;
//info(strfmt("%1",strUserID));
//Trad5
// if(strUserID== "Admin")
if(strUserID== "Trad4" || strUserID== "Trad5")
{
// INTERNAL BEGIN
// Pantep Cus1.2
dialogCheckBeforePost = Box::okCancel(strfmt("%1 \n %2",SalesParmTable.VBS_ReservedInvoice,SalesParmTable.Transdate),DialogButton::No,"Check before Post");
if(dialogCheckBeforePost == DialogButton::Ok)
{
// End Cus1.2
if(updateNow.value())
{
if(element.vbs_checkMultipleAccount())
{
error("Can not post multiple customer account");
return;
}
switch (documentStatus)
{
case documentStatus::Confirmation:
if(!SalesparmTable.VBS_ReservedInvoice)
{
while select _SalesParmLineforCancle where _SalesParmLineforCancle.ParmId == SalesparmTable.ParmId
{
//info(strfmt("%1",_SalesParmLineforCancle.DeliverNow));
if(_SalesParmLineforCancle.DeliverNow < 0)
{
error("Please select reserved invoice to cancle");
return;
}
}
}
else
{
while select _SalesParmLineforCancle where _SalesParmLineforCancle.ParmId == SalesparmTable.ParmId
{
//info(strfmt("%1",_SalesParmLineforCancle.DeliverNow));
if(_SalesParmLineforCancle.DeliverNow < 0)
{
select forupdate CustConfirmJour where CustConfirmJour.VBS_ReservedInvoice == SalesparmTable.VBS_ReservedInvoice
&& CustConfirmJour.VBS_Cancel == NoYes::No;
if(CustConfirmJour)
{
ttsbegin;
CustConfirmJour.VBS_Cancel = NoYes::Yes;
CustConfirmJour.update();
ttscommit;
}
element.close();
info(strfmt("Invoice %1 has been cancled",SalesparmTable.VBS_ReservedInvoice));
}
else
{
select forupdate CustConfirmJour where CustConfirmJour.VBS_ReservedInvoice == SalesparmTable.VBS_ReservedInvoice
&& CustConfirmJour.VBS_Cancel == NoYes::No;
if(CustConfirmJour)
{
ttsbegin;
CustConfirmJour.VBS_ReservedInvoice = "";
CustConfirmJour.update();
ttscommit;
}
}
}
}
break;
case documentStatus::PickingList:
if(!SalesparmTable.VBS_ReservedInvoice)
{
if(!element.vbs_checkPickingList())
{
error("Please select reserved invoice");
return;
}
}
break;
case documentStatus::PackingSlip:
if(!SalesparmTable.VBS_ReservedInvoice)
{
if(!element.vbs_checkPackingSlip() && _SalesParmLineforCancle.DeliverNow < 0)
{
error("Please select reserved invoice");
return;
}
}
break;
}
}
//vbs end
super();
// Pantep Cus1.5
}
else
{
return;
}
//End Cus1.5
//INTERNAL END
}
else
{
//info("external");
if(updateNow.value())
{
if(element.vbs_checkMultipleAccount())
{
error("Can not post multiple customer account");
return;
}
switch (documentStatus)
{
case documentStatus::Confirmation:
if(!SalesparmTable.VBS_ReservedInvoice)
{
while select _SalesParmLineforCancle where _SalesParmLineforCancle.ParmId == SalesparmTable.ParmId
{
//info(strfmt("%1",_SalesParmLineforCancle.DeliverNow));
if(_SalesParmLineforCancle.DeliverNow < 0)
{
error("Please select reserved invoice to cancle");
return;
}
}
}
else
{
while select _SalesParmLineforCancle where _SalesParmLineforCancle.ParmId == SalesparmTable.ParmId
{
//info(strfmt("%1",_SalesParmLineforCancle.DeliverNow));
if(_SalesParmLineforCancle.DeliverNow < 0)
{
select forupdate CustConfirmJour where CustConfirmJour.VBS_ReservedInvoice == SalesparmTable.VBS_ReservedInvoice
&& CustConfirmJour.VBS_Cancel == NoYes::No;
if(CustConfirmJour)
{
ttsbegin;
CustConfirmJour.VBS_Cancel = NoYes::Yes;
CustConfirmJour.update();
ttscommit;
}
element.close();
info(strfmt("Invoice %1 has been cancled",SalesparmTable.VBS_ReservedInvoice));
}
else
{
select forupdate CustConfirmJour where CustConfirmJour.VBS_ReservedInvoice == SalesparmTable.VBS_ReservedInvoice
&& CustConfirmJour.VBS_Cancel == NoYes::No;
if(CustConfirmJour)
{
ttsbegin;
CustConfirmJour.VBS_ReservedInvoice = "";
CustConfirmJour.update();
ttscommit;
}
}
}
}
break;
case documentStatus::PickingList:
if(!SalesparmTable.VBS_ReservedInvoice)
{
if(!element.vbs_checkPickingList())
{
error("Please select reserved invoice");
return;
}
}
break;
case documentStatus::PackingSlip:
if(!SalesparmTable.VBS_ReservedInvoice)
{
if(!element.vbs_checkPackingSlip() && _SalesParmLineforCancle.DeliverNow < 0)
{
error("Please select reserved invoice");
return;
}
}
break;
}
}
//vbs end
super();
}
}
=================================================================
void clicked()
{
//vbs begin
SalesParmLine _SalesParmLineforCancle;
CustConfirmJour CustConfirmJour;
CustConfirmTrans CustConfirmTrans;
// Pantep Cus1
dialogButton dialogCheckBeforePost;
// End Cus1
;
// Pantep Cus1.2
dialogCheckBeforePost = Box::okCancel(strfmt("%1 \n %2",SalesParmTable.VBS_ReservedInvoice,SalesParmTable.Transdate),DialogButton::No,"Check before Post");
if(dialogCheckBeforePost == DialogButton::Ok)
{
// End Cus1.2
if(updateNow.value())
{
if(element.vbs_checkMultipleAccount())
{
error("Can not post multiple customer account");
return;
}
switch (documentStatus)
{
case documentStatus::Confirmation:
if(!SalesparmTable.VBS_ReservedInvoice)
{
while select _SalesParmLineforCancle where _SalesParmLineforCancle.ParmId == SalesparmTable.ParmId
{
//info(strfmt("%1",_SalesParmLineforCancle.DeliverNow));
if(_SalesParmLineforCancle.DeliverNow < 0)
{
error("Please select reserved invoice to cancle");
return;
}
}
}
else
{
while select _SalesParmLineforCancle where _SalesParmLineforCancle.ParmId == SalesparmTable.ParmId
{
//info(strfmt("%1",_SalesParmLineforCancle.DeliverNow));
if(_SalesParmLineforCancle.DeliverNow < 0)
{
select forupdate CustConfirmJour where CustConfirmJour.VBS_ReservedInvoice == SalesparmTable.VBS_ReservedInvoice
&& CustConfirmJour.VBS_Cancel == NoYes::No;
if(CustConfirmJour)
{
ttsbegin;
CustConfirmJour.VBS_Cancel = NoYes::Yes;
CustConfirmJour.update();
ttscommit;
}
element.close();
info(strfmt("Invoice %1 has been cancled",SalesparmTable.VBS_ReservedInvoice));
}
else
{
select forupdate CustConfirmJour where CustConfirmJour.VBS_ReservedInvoice == SalesparmTable.VBS_ReservedInvoice
&& CustConfirmJour.VBS_Cancel == NoYes::No;
if(CustConfirmJour)
{
ttsbegin;
CustConfirmJour.VBS_ReservedInvoice = "";
CustConfirmJour.update();
ttscommit;
}
}
}
}
break;
case documentStatus::PickingList:
if(!SalesparmTable.VBS_ReservedInvoice)
{
if(!element.vbs_checkPickingList())
{
error("Please select reserved invoice");
return;
}
}
break;
case documentStatus::PackingSlip:
if(!SalesparmTable.VBS_ReservedInvoice)
{
if(!element.vbs_checkPackingSlip() && _SalesParmLineforCancle.DeliverNow < 0)
{
error("Please select reserved invoice");
return;
}
}
break;
}
}
//vbs end
super();
// Pantep Cus1.5
}
else
{
return;
}
//End Cus1.5
}
==================================================================
display real dispPrice()
{
real rqty, rvalue;
SysClientSessions scs;
str strUserID, strCompName;
;
//Get Client
select * from scs where scs.clientComputer == WinAPI::getComputerName();
strUserID = scs.userId;
//
rqty = this.quantitySum();
rvalue = this.valueSum();
if(rqty == 0)
{
rPrice = 0;
}else
{
if(strUserID == "Audit"||strUserID == "Audi1"||strUserID == "Audi2"||strUserID == "Audi3"||
strUserID == "Audi4"||strUserID == "Audi5"||strUserID == "Admin"||strUserID == "com_c"||
strUserID == "Comp1"||strUserID == "compu")
{
rPrice = rvalue/rqty;
}else
rPrice = 0;
//rPrice = rvalue/rqty;
}
return rPrice;
}
================================================
void clicked()
{
//vbs begin
SalesParmLine _SalesParmLineforCancle;
CustConfirmJour CustConfirmJour;
CustConfirmTrans CustConfirmTrans;
// Pantep Cus1
dialogButton dialogCheckBeforePost;
// End Cus1
SysClientSessions scs;
str strUserID;
;
select * from scs where scs.clientComputer == WinAPI::getComputerName();
strUserID = scs.userId;
if(strUserID== "Trad4")
{
// INTERNAL BEGIN
// Pantep Cus1.2
dialogCheckBeforePost = Box::okCancel(strfmt("%1 \n %2",SalesParmTable.VBS_ReservedInvoice,SalesParmTable.Transdate),DialogButton::No,"Check before Post");
if(dialogCheckBeforePost == DialogButton::Ok)
{
// End Cus1.2
if(updateNow.value())
{
if(element.vbs_checkMultipleAccount())
{
error("Can not post multiple customer account");
return;
}
switch (documentStatus)
{
case documentStatus::Confirmation:
if(!SalesparmTable.VBS_ReservedInvoice)
{
while select _SalesParmLineforCancle where _SalesParmLineforCancle.ParmId == SalesparmTable.ParmId
{
//info(strfmt("%1",_SalesParmLineforCancle.DeliverNow));
if(_SalesParmLineforCancle.DeliverNow < 0)
{
error("Please select reserved invoice to cancle");
return;
}
}
}
else
{
while select _SalesParmLineforCancle where _SalesParmLineforCancle.ParmId == SalesparmTable.ParmId
{
//info(strfmt("%1",_SalesParmLineforCancle.DeliverNow));
if(_SalesParmLineforCancle.DeliverNow < 0)
{
select forupdate CustConfirmJour where CustConfirmJour.VBS_ReservedInvoice == SalesparmTable.VBS_ReservedInvoice
&& CustConfirmJour.VBS_Cancel == NoYes::No;
if(CustConfirmJour)
{
ttsbegin;
CustConfirmJour.VBS_Cancel = NoYes::Yes;
CustConfirmJour.update();
ttscommit;
}
element.close();
info(strfmt("Invoice %1 has been cancled",SalesparmTable.VBS_ReservedInvoice));
}
else
{
select forupdate CustConfirmJour where CustConfirmJour.VBS_ReservedInvoice == SalesparmTable.VBS_ReservedInvoice
&& CustConfirmJour.VBS_Cancel == NoYes::No;
if(CustConfirmJour)
{
ttsbegin;
CustConfirmJour.VBS_ReservedInvoice = "";
CustConfirmJour.update();
ttscommit;
}
}
}
}
break;
case documentStatus::PickingList:
if(!SalesparmTable.VBS_ReservedInvoice)
{
if(!element.vbs_checkPickingList())
{
error("Please select reserved invoice");
return;
}
}
break;
case documentStatus::PackingSlip:
if(!SalesparmTable.VBS_ReservedInvoice)
{
if(!element.vbs_checkPackingSlip() && _SalesParmLineforCancle.DeliverNow < 0)
{
error("Please select reserved invoice");
return;
}
}
break;
}
}
//vbs end
super();
// Pantep Cus1.5
}
else
{
return;
}
//End Cus1.5
//INTERNAL END
}
else
{
info("external");
if(updateNow.value())
{
if(element.vbs_checkMultipleAccount())
{
error("Can not post multiple customer account");
return;
}
switch (documentStatus)
{
case documentStatus::Confirmation:
if(!SalesparmTable.VBS_ReservedInvoice)
{
while select _SalesParmLineforCancle where _SalesParmLineforCancle.ParmId == SalesparmTable.ParmId
{
//info(strfmt("%1",_SalesParmLineforCancle.DeliverNow));
if(_SalesParmLineforCancle.DeliverNow < 0)
{
error("Please select reserved invoice to cancle");
return;
}
}
}
else
{
while select _SalesParmLineforCancle where _SalesParmLineforCancle.ParmId == SalesparmTable.ParmId
{
//info(strfmt("%1",_SalesParmLineforCancle.DeliverNow));
if(_SalesParmLineforCancle.DeliverNow < 0)
{
select forupdate CustConfirmJour where CustConfirmJour.VBS_ReservedInvoice == SalesparmTable.VBS_ReservedInvoice
&& CustConfirmJour.VBS_Cancel == NoYes::No;
if(CustConfirmJour)
{
ttsbegin;
CustConfirmJour.VBS_Cancel = NoYes::Yes;
CustConfirmJour.update();
ttscommit;
}
element.close();
info(strfmt("Invoice %1 has been cancled",SalesparmTable.VBS_ReservedInvoice));
}
else
{
select forupdate CustConfirmJour where CustConfirmJour.VBS_ReservedInvoice == SalesparmTable.VBS_ReservedInvoice
&& CustConfirmJour.VBS_Cancel == NoYes::No;
if(CustConfirmJour)
{
ttsbegin;
CustConfirmJour.VBS_ReservedInvoice = "";
CustConfirmJour.update();
ttscommit;
}
}
}
}
break;
case documentStatus::PickingList:
if(!SalesparmTable.VBS_ReservedInvoice)
{
if(!element.vbs_checkPickingList())
{
error("Please select reserved invoice");
return;
}
}
break;
case documentStatus::PackingSlip:
if(!SalesparmTable.VBS_ReservedInvoice)
{
if(!element.vbs_checkPackingSlip() && _SalesParmLineforCancle.DeliverNow < 0)
{
error("Please select reserved invoice");
return;
}
}
break;
}
}
//vbs end
super();
}
}
==============================================
void clicked()
{
//vbs begin
SalesParmLine _SalesParmLineforCancle;
CustConfirmJour CustConfirmJour;
CustConfirmTrans CustConfirmTrans;
// Pantep Cus1
dialogButton dialogCheckBeforePost;
// End Cus1
SysClientSessions scs;
str strUserID;
;
select * from scs where scs.clientComputer == WinAPI::getComputerName();
// strUserID = scs.userId;
strUserID = curuserId();
//print strUserID;
//pause;
//info(strfmt("%1",strUserID));
//Trad5
// if(strUserID== "Admin")
if(strUserID== "Trad4" || strUserID== "Trad5")
{
// INTERNAL BEGIN
// Pantep Cus1.2
dialogCheckBeforePost = Box::okCancel(strfmt("%1 \n %2",SalesParmTable.VBS_ReservedInvoice,SalesParmTable.Transdate),DialogButton::No,"Check before Post");
if(dialogCheckBeforePost == DialogButton::Ok)
{
// End Cus1.2
if(updateNow.value())
{
if(element.vbs_checkMultipleAccount())
{
error("Can not post multiple customer account");
return;
}
switch (documentStatus)
{
case documentStatus::Confirmation:
if(!SalesparmTable.VBS_ReservedInvoice)
{
while select _SalesParmLineforCancle where _SalesParmLineforCancle.ParmId == SalesparmTable.ParmId
{
//info(strfmt("%1",_SalesParmLineforCancle.DeliverNow));
if(_SalesParmLineforCancle.DeliverNow < 0)
{
error("Please select reserved invoice to cancle");
return;
}
}
}
else
{
while select _SalesParmLineforCancle where _SalesParmLineforCancle.ParmId == SalesparmTable.ParmId
{
//info(strfmt("%1",_SalesParmLineforCancle.DeliverNow));
if(_SalesParmLineforCancle.DeliverNow < 0)
{
select forupdate CustConfirmJour where CustConfirmJour.VBS_ReservedInvoice == SalesparmTable.VBS_ReservedInvoice
&& CustConfirmJour.VBS_Cancel == NoYes::No;
if(CustConfirmJour)
{
ttsbegin;
CustConfirmJour.VBS_Cancel = NoYes::Yes;
CustConfirmJour.update();
ttscommit;
}
element.close();
info(strfmt("Invoice %1 has been cancled",SalesparmTable.VBS_ReservedInvoice));
}
else
{
select forupdate CustConfirmJour where CustConfirmJour.VBS_ReservedInvoice == SalesparmTable.VBS_ReservedInvoice
&& CustConfirmJour.VBS_Cancel == NoYes::No;
if(CustConfirmJour)
{
ttsbegin;
CustConfirmJour.VBS_ReservedInvoice = "";
CustConfirmJour.update();
ttscommit;
}
}
}
}
break;
case documentStatus::PickingList:
if(!SalesparmTable.VBS_ReservedInvoice)
{
if(!element.vbs_checkPickingList())
{
error("Please select reserved invoice");
return;
}
}
break;
case documentStatus::PackingSlip:
if(!SalesparmTable.VBS_ReservedInvoice)
{
if(!element.vbs_checkPackingSlip() && _SalesParmLineforCancle.DeliverNow < 0)
{
error("Please select reserved invoice");
return;
}
}
break;
}
}
//vbs end
super();
// Pantep Cus1.5
}
else
{
return;
}
//End Cus1.5
//INTERNAL END
}
else
{
//info("external");
if(updateNow.value())
{
if(element.vbs_checkMultipleAccount())
{
error("Can not post multiple customer account");
return;
}
switch (documentStatus)
{
case documentStatus::Confirmation:
if(!SalesparmTable.VBS_ReservedInvoice)
{
while select _SalesParmLineforCancle where _SalesParmLineforCancle.ParmId == SalesparmTable.ParmId
{
//info(strfmt("%1",_SalesParmLineforCancle.DeliverNow));
if(_SalesParmLineforCancle.DeliverNow < 0)
{
error("Please select reserved invoice to cancle");
return;
}
}
}
else
{
while select _SalesParmLineforCancle where _SalesParmLineforCancle.ParmId == SalesparmTable.ParmId
{
//info(strfmt("%1",_SalesParmLineforCancle.DeliverNow));
if(_SalesParmLineforCancle.DeliverNow < 0)
{
select forupdate CustConfirmJour where CustConfirmJour.VBS_ReservedInvoice == SalesparmTable.VBS_ReservedInvoice
&& CustConfirmJour.VBS_Cancel == NoYes::No;
if(CustConfirmJour)
{
ttsbegin;
CustConfirmJour.VBS_Cancel = NoYes::Yes;
CustConfirmJour.update();
ttscommit;
}
element.close();
info(strfmt("Invoice %1 has been cancled",SalesparmTable.VBS_ReservedInvoice));
}
else
{
select forupdate CustConfirmJour where CustConfirmJour.VBS_ReservedInvoice == SalesparmTable.VBS_ReservedInvoice
&& CustConfirmJour.VBS_Cancel == NoYes::No;
if(CustConfirmJour)
{
ttsbegin;
CustConfirmJour.VBS_ReservedInvoice = "";
CustConfirmJour.update();
ttscommit;
}
}
}
}
break;
case documentStatus::PickingList:
if(!SalesparmTable.VBS_ReservedInvoice)
{
if(!element.vbs_checkPickingList())
{
error("Please select reserved invoice");
return;
}
}
break;
case documentStatus::PackingSlip:
if(!SalesparmTable.VBS_ReservedInvoice)
{
if(!element.vbs_checkPackingSlip() && _SalesParmLineforCancle.DeliverNow < 0)
{
error("Please select reserved invoice");
return;
}
}
break;
}
}
//vbs end
super();
}
}
ไม่มีความคิดเห็น:
แสดงความคิดเห็น