11 lines
11 KiB
JSON
11 lines
11 KiB
JSON
{
|
|
"header": {
|
|
"version": 1,
|
|
"type": "record"
|
|
},
|
|
"body": {
|
|
"record1": {
|
|
"<1>": "declare function rowexists, fieldcount, msg, utility, set_fserror, next_mesa_invoice_key, Get_Status\r\ndeclare subroutine forward_event, create_note, Set_Status, obj_Schedule, ErrMsg\r\n$insert logical\r\n$insert schedule_equ\r\n$insert msg_equates\r\n$insert quote_sigs_equ\r\n$insert wafer_inv_equ\r\n$INSERT NOTIFICATION_EQU\r\n\r\nVoid = utility( 'CURSOR', 'H' )\r\nequ Item$ to 1\r\nequ QuoteNo$ to 2\r\nequ SchedNo$ to 3\r\nequ Wo$ to 4\r\nequ PartNo$ to 5\r\nequ LotNo$ to 6\r\nequ GLAcct$ to 7\r\nequ Setup$ to 8\r\nequ Srp$ to 9\r\nequ Qty$ to 10\r\nequ Rejects$ to 11\r\nequ Unprocessed$ to 12\r\nequ Price$ to 13\r\nequ Amount$ to 14\r\nequ PSN$ to 15\r\nequ WafInv$ to 16\r\n\r\nequ CrLf$ to char(13):char(10)\r\n\r\nopen 'WAFER_INV' to WafInvTable else\r\n Void = msg( '', 'Unable to open WAFER_INV...' )\r\n return 0\r\nend\r\nPossibleWafInvUpdate = false$\r\nInvUpdateMsg = ''\r\nLockMessage = ''\r\nTinv = .invoice_no->text\r\n*if rowexists( 'INVOICE', Tinv ) else\r\n/* \r\n \r\n MsgInfo = ''\r\n MsgInfo<micon$> = '!'\r\n MsgInfo<mtype$> = 'BNY'\r\n MsgInfo<mtext$> = 'Do you wish to send a message to the shipping manager?'\r\n MsgInfo<mdefbtn$> = 2 \r\n Resp = msg( '', MsgInfo )\r\n * HARD CODE FOR NOW UNTIL WE GET A SHIPPING MANAGER\r\n if Resp = 1 then\r\n Subject = 'New Invoice# ':Tinv\r\n Note = 'Invoice# ':Tinv:' was created by ':oconv( @user4, \"[XLATE_CONV,LSL_USERS*FIRST_LAST]\" )\r\n Note:= ' on ':oconv( date(), 'D2/' ):' at ':oconv( time(), 'MTH' ):'...Please see attachment'\r\n \r\n SendTo = XLATE('NOTIFICATION','WO_ENTRY',NOTIFICATION_USER_ID$,'X')\r\n create_note( SendTo, @user4, Subject, Note, 'INVOICE', Tinv ) \r\n end\r\n*/\r\n*end\r\nNoSave = false$\r\nOInvoiceDetail = get_property( @window, '@OrigInvoiceDetail' )\r\nInvoiceDetail = .invoice_detail->array\r\nForceUpdate = .force_update->check\r\n\r\nTrackNos\t= Get_Property(@WINDOW:'.TRACKING_NO','ARRAY')\r\n\r\nSWAP @vm:@vm WITH '' IN TrackNos\r\nIF TrackNos[-1,1] = @vm THEN TrackNos[-1,1] = ''\r\nSWAP @vm WITH ', ' in TrackNos \r\n\r\nInvNo\t= .INVOICE_NO->TEXT\r\nShipDt\t= .SHIP_DATE->TEXT\r\nBoxCnt\t= .BOX_CNT->TEXT\r\nShipVia\t= .SHIPPER_INFO->TEXT\r\n\t\t\r\nNewSystemDt = ICONV('7/25/2005','D')\t\t;* Date of new Order Entry System Implementation\r\n\r\nRow = 1\r\nRcnt = fieldcount( InvoiceDetail<1>, @vm )\r\nfor Row = 1 to Rcnt\r\n ThisInvoiceLine = InvoiceDetail<Item$,Row>:@vm:@vm:InvoiceDetail<SchedNo$,Row>:@vm\r\n ThisInvoiceLine:= InvoiceDetail<WO$,Row>:@vm:InvoiceDetail<PartNo$,Row>:@vm\r\n ThisInvoiceLine:= InvoiceDetail<LotNo$,Row>:@vm:InvoiceDetail<GlAcct$,Row>:@vm\r\n ThisInvoiceLine:= InvoiceDetail<Setup$,Row>:@vm\r\n ThisInvoiceLine:= InvoiceDetail<Srp$,Row>:@vm:InvoiceDetail<Qty$,Row>:@vm\r\n ThisInvoiceLine:= InvoiceDetail<Rejects$,Row>:@vm:InvoiceDetail<Unprocessed$,Row>:@vm\r\n ThisInvoiceLine:= InvoiceDetail<Price$,Row>:@vm:@vm:@vm:InvoiceDetail<WafInv$,Row>\r\n *\r\n ThisOInvoiceLine = OInvoiceDetail<Item$,Row>:@vm:@vm:OInvoiceDetail<SchedNo$,Row>:@vm\r\n ThisOInvoiceLine:= OInvoiceDetail<WO$,Row>:@vm:OInvoiceDetail<PartNo$,Row>:@vm\r\n ThisOInvoiceLine:= OInvoiceDetail<LotNo$,Row>:@vm:OInvoiceDetail<GlAcct$,Row>:@vm\r\n ThisOInvoiceLine:= OInvoiceDetail<Setup$,Row>:@vm\r\n ThisOInvoiceLine:= OInvoiceDetail<Srp$,Row>:@vm:OInvoiceDetail<Qty$,Row>:@vm\r\n ThisOInvoiceLine:= OInvoiceDetail<Rejects$,Row>:@vm:OInvoiceDetail<Unprocessed$,Row>:@vm\r\n ThisOInvoiceLine:= OInvoiceDetail<Price$,Row>:@vm:@vm:@vm:OInvoiceDetail<WafInv$,Row>\r\n if ( ForceUpdate ) or ( ThisInvoiceLine <> ThisOInvoiceLine ) then\r\n if ThisInvoiceLine <> str( @vm, 15 ) then\r\n\t * this row has been changed/added\r\n\t CurItem = ThisInvoiceLine<1,Item$>\r\n\t CurSched = ThisInvoiceLine<1,SchedNo$>\r\n\t CurSetup = ThisInvoiceLine<1,Setup$>\r\n\t CurSrp = ThisInvoiceLine<1,Srp$>\r\n\t CurUnpr = ThisInvoiceLine<1,Unprocessed$>\r\n\t CurRejects = ThisInvoiceLine<1,Rejects$>\r\n\t CurQty = ThisInvoiceLine<1,Qty$>\r\n\t CurPrice = ThisInvoiceLine<1,Price$>\r\n\t CurGl = ThisInvoiceLine<1,GlAcct$>\r\n\t CurWafInv = ThisInvoiceLine<1,WafInv$>\r\n\t CurPartNum = ThisInvoiceLine<1,PartNo$>\r\n\t CurLotNum = ThisInvoiceLine<1,LotNo$>\r\n\t CurWO = ThisInvoiceLine<1,WO$>\r\n\t if CurSched <> '' then\r\n\t * update the schedule\r\n\t gosub UpdateSchedRec\r\n\t gosub UpdateWafInv\r\n\t end else\r\n\t if .invoice_no->text[1,2] = 'CM' then\r\n\t * let them save it is a credit memo\r\n\t end else\r\n\t \tEntryDt = .entry_date->text\r\n\t \tEntryDt = ICONV(EntryDt,'D')\r\n\t \tIF EntryDt < NewSystemDt THEN\r\n\t\t \r\n\t\t\t\t\t\tError = ''\r\n\t\t\t\t\t\tif CurSched = '' then\r\n\t\t\t\t\t\t\tError = ' must have a schedule number'\r\n\t\t\t\t\t\tend\r\n\t\t\t\t\t\tNoSave = true$\r\n\t\t\t\t\t\tMsgInfo = ''\r\n\t\t\t\t\t\tMsgInfo<micon$> = '!'\r\n\t\t\t\t\t\tMsgInfo<mtext$> = 'Invoice line ':Row:Error:'. No schedule updated for this line.'\r\n\t\t\t\t\t\tVoid = msg( '', MsgInfo )\r\n\t\t\t\t\t\tNoSave = true$\r\n\t\t\t\t\tEND\r\n\t\t end\r\n\t end\r\n\t end\r\n end \r\nnext Row\r\nVoid = utility( 'CURSOR', 'A' )\r\nif ( PossibleWafInvUpdate = false$ ) then\r\n * DO NOT SEND A MESSAGE CAUSE NO ACTIVITY IN WAFER INVENTORY\r\nend else\r\n if InvUpdateMsg = '' then\r\n * POSSIBLE UPDATE BUT NOTHING CHANGED IN THE QUANTITY\r\n MsgInfo = ''\r\n MsgInfo<mtext$> = 'No wafer inventory updates...'\r\n MsgInfo<micon$> = '!'\r\n Void = msg( '', MsgInfo )\r\n end else\r\n * WE HAVE AN UPDATE SO DISPLAY TO USER\r\n MsgInfo = ''\r\n MsgInfo<mtext$> = InvUpdateMsg\r\n MsgInfo<micon$> = '!'\r\n Void = msg( '', MsgInfo )\r\n end\r\nend\r\nif NoSave else\r\n forward_event()\r\nend\r\nif LockMessage then\r\n LockMessage[-2,2] = ''\r\n MsgInfo = ''\r\n MsgInfo<mtext$> = LockMessage\r\n MsgInfo<micon$> = '!'\r\n Void = msg( '', MsgInfo )\r\nend\r\nreturn 0\r\n*===========================================================================*\r\nUpdateSchedRec:\r\n\r\nSchedKey\t\t= CurSched\r\nSetupCharge\t\t= CurSetup\r\nSRPCharge\t\t= CurSRP\r\nShipQty\t\t\t= CurQty\r\nShipPrice\t\t= CurPrice\r\nRejects\t\t\t= CurRejects\r\nUnprocessed\t\t= CurUnpr\r\n\r\nParms = InvNo:@RM:SchedKey:@RM:SetupCharge:@RM:SRPCharge:@RM:ShipQty:@RM:ShipPrice:@RM\r\nParms := ShipVia:@RM:Rejects:@RM:Unprocessed:@RM:BoxCnt:@RM:TrackNos:@RM:ShipDt\r\n\r\nSet_Status(0)\r\nobj_Schedule('AddInvoice',Parms)\t;* Restore invoice information on Schedules\r\nIF Get_Status(errCode) THEN\r\n\tErrMsg(errCode)\r\n\tSet_Status(0)\r\nEND\r\nreturn\r\n\r\n*===========================================================================*\r\nUpdateWafInv:\r\n\t* ADJUST INVENTORY TO INPROCESS IF APPLICABLE\r\n\tInvoiceNo = .invoice_no->text\r\n\tif ( CurWafInv <> '' ) then\r\n PossibleWafInvUpdate = true$\r\n\t * THERE IS AN INVENTORY NUMBER AND THE QUANTITY HAS EITHER CHANGED\r\n\t * OR THIS IS A NEW LINE\r\n\t * NOW LETS MAKE SURE THERE IS A QTY\r\n\t if ( CurQty > 0 or CurRejects > 0 or CurUnpr > 0 ) and ( ( CurQty <> ThisOInvoiceLine<1,Qty$> or CurRejects <> ThisOInvoiceLine<1,Rejects$> or CurUnpr <> ThisOInvoiceLine<1,Unprocessed$> ) or ( ForceUpdate = true$ ) ) then\r\n lock WafInvTable, CurWafInv then\r\n\t WIRec = xlate( 'WAFER_INV', CurWafInv, '', 'X' )\r\n\t OLCnt = fieldcount( WIRec<wafer_inv_order_no$>, @vm )\r\n\t LineFoundOn = 0\r\n\t\t\t for Ww = 1 to OLCnt\r\n\t\t\t ThisInvOrderNo = WIRec<wafer_inv_order_no$,Ww>\r\n\t\t\t\t ThisInvOrderLine = WIRec<wafer_inv_order_line$,Ww>\r\n\t\t\t\t ThisInvInvoiceNo = WIRec<wafer_inv_lsl_invoice_no$,Ww>\r\n\t if ( ThisInvOrderNo = .order_no->text ) and ( ThisInvOrderLine = CurItem ) and ( ThisInvInvoiceNo = InvoiceNo ) then\r\n\t LineFoundOn = Ww\r\n\t end\r\n next Ww\r\n * NO MORE POSTING THE PARTNUMBER TO WAFER INVENTORY\r\n * AS OF 3/18/99 TO SATISFY OKMETIC\r\n \t\t *if CurLotNum[1,2] = 'OK' then\r\n\t\t\t * LotPart = CurPartNum\r\n *end else\r\n LotPart = CurLotNum\r\n *end\r\n if LineFoundOn > 0 then\r\n\t\t\t WIRec<wafer_inv_lsl_po$,LineFoundOn> = .po->text\r\n\t\t\t\t WIRec<wafer_inv_mfg_lot_no$,LineFoundOn> = LotPart\r\n\t\t\t WIRec<wafer_inv_lsl_wo$,LineFoundOn> = CurWo\r\n\t\t\t WIRec<wafer_inv_ship_date$,LineFoundOn> = date()\r\n\t\t\t WIRec<wafer_inv_in_process$,LineFoundOn> = '-':CurQty+CurRejects\r\n\t\t\t WIRec<wafer_inv_ship_qty$,LineFoundOn> = CurQty\r\n\t\t\t WIRec<wafer_inv_rejects$,LineFoundOn> = CurRejects\r\n\t end else\r\n\t Npos = OLCnt + 1\r\n\t WIRec<wafer_inv_order_no$,Npos> = .order_no->text\r\n\t WIRec<wafer_inv_order_line$,Npos> = CurItem\r\n\t\t\t WIRec<wafer_inv_lsl_po$,Npos> = .po->text\r\n\t\t\t\t WIRec<wafer_inv_mfg_lot_no$,Npos> = LotPart\r\n\t\t\t WIRec<wafer_inv_lsl_wo$,Npos> = CurWo\r\n\t\t\t WIREc<wafer_inv_lsl_invoice_no$,Npos> = InvoiceNo\r\n\t\t\t WIRec<wafer_inv_ship_date$,Npos> = date() \r\n\t\t\t WIRec<wafer_inv_in_process$,Npos> = '-':CurQty+CurRejects \t\t\t \r\n\t\t\t WIRec<wafer_inv_ship_qty$,Npos> = CurQty\r\n\t\t\t WIRec<wafer_inv_rejects$,Npos> = CurRejects\t\t \r\n\t end\r\n if InvUpdateMsg = '' then\r\n InvUpdateMsg = 'The following wafer inventory records were updated: ':CrLf$\r\n end\r\n\t InvUpdateMsg := 'Inventory#':CurWafInv:' from order line ':Row:CrLf$\r\n\t write WIRec on WafInvTable, CurWafInv else\r\n\t Void = msg( '', 'Unable to write ':CurWafInv:' on WAFER_INV...' )\r\n\t\t end\r\n unlock WafInvTable, CurWafInv else\r\n\t\t MsgInfo = ''\r\n\t\t\t\t MsgInfo<mtext$> = 'Unable to unlock wafer inventory#':CurWafInv\r\n\t\t\t\t MsgInfo<micon$> = '!'\r\n\t\t\t\t Void = msg( '', MsgInfo )\r\n\t\t\t end\r\n end else\r\n\t\t\t MsgInfo = ''\r\n\t\t\t MsgInfo<mtext$> = 'Unable to update wafer inventory#':CurWafInv:' for invoice line ':Row:' due to it currently being in use. You will need to manually update this inventory...'\r\n\t\t\t MsgInfo<micon$> = '!'\r\n\t\t\t Void = msg( '', MsgInfo )\r\n end\r\n end\t \r\nreturn\r\n"
|
|
}
|
|
}
|
|
} |