jdr0606
asked on
Explain what this section of code does
Hello,
I am looking at one of the functions inside of an integration application that we use to remove shipcomplete holds since some orders have not been automatically released like they should. I'm new to C++ Builder and I don't understand what the function is doing. The entire function is below.
The main part that I don't understand is the record count and how it relates with removing the hold and how the values of the Add() function are calculated (the part with the formula atyalloc + qtyprinv != quantity - qtycance). Please explain this in as much detail as possible.
Thanks for your help!
void __fastcall TKeleForm::ShipCompleteUpd ate()
{
ShipCompleteQuery();
TDateTime wow = Now();
DM->GPXOPQuery->First();
while(!DM->GPXOPQuery->Eof )
{
salesordernmbr = DM->GPXOPQuery->FieldByNam e("SOPNUMB E")->AsStr ing;
DM->GPModifyQuery->Close() ;
DM->GPModifyQuery->SQL->Cl ear();
DM->GPModifyQuery->SQL->Ad d("Select Count(*) As Recordcount From SOP10200 ");
DM->GPModifyQuery->SQL->Ad d("Where SOPNUMBE = '" + salesordernmbr + "'");
//December 17, 2002 Added the "+ QTYPRINV" to following line
//DM->GPModifyQuery->SQL-> Add("And ATYALLOC + QTYPRINV != QUANTITY ");
DM->GPModifyQuery->SQL->Ad d("And ATYALLOC + QTYPRINV != QUANTITY - QTYCANCE ");
//January 7, 2005 Added the following And statements
DM->GPModifyQuery->SQL->Ad d("And ITEMNMBR != 'FREIGHT' ");
DM->GPModifyQuery->SQL->Ad d("And ITEMNMBR != 'REPAIRS' ");
DM->GPModifyQuery->SQL->Ad d("And ITEMNMBR != 'LABOR' ");
DM->GPModifyQuery->SQL->Ad d("And ITEMNMBR != 'RESTOCKING FEE' ");
DM->GPModifyQuery->SQL->Ad d("And ITEMNMBR != 'EXPEDITE FEE' ");
DM->GPModifyQuery->SQL->Ad d("And ITEMNMBR != 'MISCELLANEOUS' ");
DM->GPModifyQuery->SQL->Ad d("And ITEMNMBR != 'UL FEES' ");
DM->GPModifyQuery->SQL->Ad d("And ITEMNMBR != 'ENGINEERING FEE' ");
DM->GPModifyQuery->Open();
recordcount = DM->GPModifyQuery->FieldBy Name("RECO RDCOUNT")- >AsInteger ;
if(recordcount == 0)
{
DM->GPModifyQuery->Close() ;
DM->GPModifyQuery->SQL->Cl ear();
DM->GPModifyQuery->SQL->Ad d("Update SOP10104 ");
DM->GPModifyQuery->SQL->Ad d("Set DELETE1 = '1', ");
DM->GPModifyQuery->SQL->Ad d("USERID = 'Int', ");
DM->GPModifyQuery->SQL->Ad d("HOLDDAT E = '" + DateToStr(wow) + "', ");
DM->GPModifyQuery->SQL->Ad d("TIME1 = '" + TimeToStr(wow) + "' ");
DM->GPModifyQuery->SQL->Ad d("Where SOPNUMBE = '" + salesordernmbr + "' ");
DM->GPModifyQuery->SQL->Ad d("And PRCHLDID = 'SHIPCOMPLETE'");
DM->GPModifyQuery->ExecSQL ();
GPFascorInsert();
}
DM->GPXOPQuery->Next();
}
}
I am looking at one of the functions inside of an integration application that we use to remove shipcomplete holds since some orders have not been automatically released like they should. I'm new to C++ Builder and I don't understand what the function is doing. The entire function is below.
The main part that I don't understand is the record count and how it relates with removing the hold and how the values of the Add() function are calculated (the part with the formula atyalloc + qtyprinv != quantity - qtycance). Please explain this in as much detail as possible.
Thanks for your help!
void __fastcall TKeleForm::ShipCompleteUpd
{
ShipCompleteQuery();
TDateTime wow = Now();
DM->GPXOPQuery->First();
while(!DM->GPXOPQuery->Eof
{
salesordernmbr = DM->GPXOPQuery->FieldByNam
DM->GPModifyQuery->Close()
DM->GPModifyQuery->SQL->Cl
DM->GPModifyQuery->SQL->Ad
DM->GPModifyQuery->SQL->Ad
//December 17, 2002 Added the "+ QTYPRINV" to following line
//DM->GPModifyQuery->SQL->
DM->GPModifyQuery->SQL->Ad
//January 7, 2005 Added the following And statements
DM->GPModifyQuery->SQL->Ad
DM->GPModifyQuery->SQL->Ad
DM->GPModifyQuery->SQL->Ad
DM->GPModifyQuery->SQL->Ad
DM->GPModifyQuery->SQL->Ad
DM->GPModifyQuery->SQL->Ad
DM->GPModifyQuery->SQL->Ad
DM->GPModifyQuery->SQL->Ad
DM->GPModifyQuery->Open();
recordcount = DM->GPModifyQuery->FieldBy
if(recordcount == 0)
{
DM->GPModifyQuery->Close()
DM->GPModifyQuery->SQL->Cl
DM->GPModifyQuery->SQL->Ad
DM->GPModifyQuery->SQL->Ad
DM->GPModifyQuery->SQL->Ad
DM->GPModifyQuery->SQL->Ad
DM->GPModifyQuery->SQL->Ad
DM->GPModifyQuery->SQL->Ad
DM->GPModifyQuery->SQL->Ad
DM->GPModifyQuery->ExecSQL
GPFascorInsert();
}
DM->GPXOPQuery->Next();
}
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.