11 lines
7.6 KiB
JSON
11 lines
7.6 KiB
JSON
{
|
|
"header": {
|
|
"version": 1,
|
|
"type": "record"
|
|
},
|
|
"body": {
|
|
"record1": {
|
|
"<1>": "declare function msg, fieldcount, memberof, next_key\r\ndeclare subroutine end_dialog, record_lock\r\n$insert logical\r\n$insert msg_equates\r\n$insert ncr_equ\r\n$insert rds_equ\r\n\r\nFlagToSaveRDS = false$\r\nRejQty = get_property( @window, '@RejQty', RejQty )\r\nNumRej = sum( .rej_info->array<1> )\r\nLossError = false$\r\nAcError = false$\r\nError = false$\r\nRDSId = get_property( @window, '@RDSId' )\r\nRejField = get_property( @window, '@RejField' )\r\nif NumRej = RejQty then\r\n CurArray = .rej_info->array\r\n NumRows = fieldcount( CurArray<1>, @vm ) +1 ;* JUST INCASE FIRST VALUE NULL\r\n for i = 1 to NumRows\r\n if CurArray<1,i> <> '' then\r\n * check to see if they have entered a loss code for every\r\n * row with rejects in it\r\n if CurArray<2,i> <> '' else\r\n LossError = true$\r\n end\r\n if memberof( @user4, 'SUPERVISOR' ) then\r\n if CurArray<4,i> <> '' else\r\n AcError = true$ \r\n end\r\n end\r\n end else\r\n if CurArray<2,i> = '' then\r\n * blank line\r\n end else\r\n LossError = true$\r\n end\r\n end\r\n Error = LossError + AcError\r\n until Error\r\n next i\r\n if Error then\r\n if LossError then\r\n MsgInfo = ''\r\n MsgInfo<micon$> = 'H'\r\n MsgInfo<mtext$> = 'You must enter rejects and a loss code for every row that contains an entry!'\r\n Void = msg( '', MsgInfo )\r\n end\r\n if AcError then\r\n MsgInfo = ''\r\n MsgInfo<micon$> = 'H'\r\n MsgInfo<mtext$> = 'You must enter an assignable cause for every row that contains rejects!'\r\n Void = msg( '', MsgInfo )\r\n end\r\n return 0\r\n end else\r\n open 'NCR' to NCRTable else\r\n Void = msg( '', 'Unable to open NCR..' )\r\n return 0\r\n end\r\n * CHECK RDS DATE\r\n * if xlate( 'RDS', RDSId, rds_entry_date$, 'X' ) > INTERNALSTARTDATE THE\r\n * REMARKED THE DATE CHECK AND GONNA DO EVERYTHING PER CHRIS H.\r\n\t for i = 1 to NumRows\r\n\t * GONNA CREATE AN NCR FOR EACH LOSS\r\n\t if ( CurArray<1,i> <> '' ) and ( CurArray<6,i> = '' ) then\r\n\t * MEANING THERE IS A LOSS CODE AND THERE IS NO NCR SO CREATE IT\r\n FlagToSaveRDS = true$ \r\n\t\t\t\tKeyToUse = next_key( 'NCR', NCRTable, 'NEXT', '' )\r\n\t\t\t\tNCRRec = ''\r\n\t\t\t\tNCRRec<ncr_entry_date$> = date()\r\n\t\t\t\tNCRRec<ncr_entry_time$> = time()\r\n\t\t\t\tNCRRec<ncr_entry_id$> = @user4\r\n\t\t\t\tNCRRec<ncr_rds_id$> = RDSId\t\t\t\t\t\t\r\n\t\t\t\tNCRRec<ncr_status$> = 'O'\r\n\t\t\t\tNCRRec<ncr_rej_cnt_field$> = RejField\r\n\t\t\t\tNCRRec<ncr_rej_cnt_value$> = i\r\n\t\t\t\twrite NCRRec on NCRTable, KeyToUse else\r\n\t\t\t\t Void = msg( '', 'Unable to write ':KeyToUse:' on NCR...')\r\n\t\t\t\t return 0\r\n\t\t\t\tend\r\n\t\t\t\tunlock NCRTable, KeyToUse else\r\n\t\t\t\t Void = msg( '', 'Unable to unlock NCR ':KeyToUse:'...' )\r\n\t\t\t\t return 0\r\n\t\t\t\tend\r\n\t\t\t\tCurArray<6,i> = KeyToUse\r\n\t\t\t Void = next_key( 'NCR', NCRTable, 'UPDATE', KeyToUse )\t\t \r\n\t end\r\n\t next i\r\n\t * NOW DELETE THE NCRS THAT WERE DELETED DUE TO ROW DELETION\r\n\t NCRsToDelete = get_property( @window, '@NCRsToDelete' )\r\n RejCntToDelete = get_property( @window, '@RejCntToDelete' )\r\n RejLossToDelete = get_property( @window, '@RejLossToDelete' )\r\n RejACToDelete = get_property( @window, '@RejACToDelete')\t \r\n\t NCnt = fieldcount( NCRsToDelete, @fm )\r\n\t if NCnt > 0 then\r\n\t FlagToSaveRDS = true$\r\n\t end\r\n\t for i = 1 to NCnt\r\n\t ThisNCR = NCRsToDelete<i>\r\n\t * NEED TO SEE IF THIS NCR HAD ANY DATA ENTERED INTO IT AND IF SO WE WILL NOT DELETE\r\n\t * SO WE READ AND REMOVE WHAT THE CODE HAD WRITTEN AND IF ANYTHING IS LEFT\r\n\t * WE THEN KNOW THAT IT HAS BEEN CHANGED\r\n\t NCRRec = xlate( 'NCR', ThisNCR, '', 'X' )\r\n\t CurStatus = NCRRec<ncr_status$>\r\n\t *AnySignature = NCRRec<ncr_dept_mgr_sig$>:NCRRec<ncr_auth_dev_sig$>\r\n\t *AnySignature:= NCRRec<ncr_auth_rej_sig$>:NCRRec<ncr_auth_rework_sig$>\r\n\t *AnySignature:= NCRRec<ncr_auth_ship_sig$>:NCRRec<ncr_vp_sig$>\r\n\t * IF WE HAVE ANY SIGNATURE ON THIS NCR WE DON'T DELETE WE WANT TO REWRITE \r\n\t * WITH 999 IN THE REJ_CNT_VALUE FIELD THIS WAY\r\n\t * IT WILL NOT REFERENCE ANY LOSS OR AC CODE IN THIS RDS\r\n\t * IT WILL FILL IN THE LOSS_CODE_ORIG, AC_CODE_ORIG\r\n\t * AND REJ_CNT_ORIG FIELDS\r\n\t * ABOVE CHANGED TO NOT CHECK FOR SIGNATURE RATHER TO CHECK FOR A NON OPEN STATUS\r\n\t * WHICH MEANS IT HAS BEEN REJECTED AND THEN ACCEPTED FOR SHIPMENT\r\n\t if CurStatus <> 'O' then\r\n\t * THIS NCR HAS BEEN SIGNED REWRITE WITH 999 IN REJ_CNT_FIELD AS MENTIONED ABOVE\r\n\t * AND FILL IN THE ORIG FIELDS\r\n\t NCRRec<ncr_rej_cnt_value$> = 999\r\n\t NCRRec<ncr_loss_code_orig$> = RejLossToDelete<i>\r\n\t NCRRec<ncr_ac_code_orig$> = RejACToDelete<i>\r\n\t NCRRec<ncr_rej_cnt_orig$> = RejCntToDelete<i>\r\n lock NCRTable, ThisNCR then\r\n\t\t\t write NCRRec on NCRTable, ThisNCR else\r\n\t\t\t Void = msg( '', 'Unable to write NCR ':ThisNCR )\r\n\t\t\t return 0\r\n\t\t\t end\r\n\t\t\t unlock NCRTable, ThisNCR else\r\n\t\t\t Void = msg( '', 'Unable to unlock NCR ':ThisNCR )\r\n\t\t\t return 0\r\n\t\t\t end\r\n\t\t\t end else\r\n\t\t\t MsgInfo = ''\r\n\t\t\t MsgInfo<mtext$> = 'Unable to lock NCR ':ThisNCR:', try at a later time.'\r\n\t\t\t MsgInfo<micon$> = 'H'\r\n\t\t\t Void = msg( '', MsgInfo )\r\n\t\t\t return 0\r\n\t\t\t end\r\n\t end else\r\n\t\t\t lock NCRTable, ThisNCR then\r\n\t\t\t delete NCRTable, ThisNCR else\r\n\t\t\t Void = msg( '', 'Unable to delete NCR ':ThisNCR )\r\n\t\t\t return 0\r\n\t\t\t end\r\n\t\t\t unlock NCRTable, ThisNCR else\r\n\t\t\t Void = msg( '', 'Unable to unlock NCR ':ThisNCR )\r\n\t\t\t return 0\r\n\t\t\t end \r\n\t\t\t end else\r\n\t\t\t MsgInfo = ''\r\n\t\t\t MsgInfo<mtext$> = 'Unable to lock NCR ':ThisNCR:', try at a later time.'\r\n\t\t\t MsgInfo<micon$> = 'H'\r\n\t\t\t Void = msg( '', MsgInfo )\r\n\t\t\t return 0\r\n\t\t\t end\r\n\t\t end\r\n\t\t next i\r\n *end\r\n if get_property( @window, '@NCRPriorWarn' ) = true$ then\r\n FlagToSaveRDS = true$\r\n end\r\n end_dialog( @window, CurArray:char(245):FlagToSaveRDS )\r\n end\r\nend else\r\n MsgInfo = ''\r\n MsgInfo<micon$> = 'H'\r\n RejType = get_property( @window, '@RejType' ) \r\n if NumRej > RejQty then\r\n * entered too many rejects\r\n Message = 'There are ':RejQty:' ':RejType:' rejects and you have '\r\n Message:= 'entered ':NumRej:', which is too many...Please fix this problem.'\r\n end else\r\n * didn't enter enough rejects\r\n Message = 'There are ':RejQty:' ':RejType:' rejects and you have '\r\n Message:= 'only entered ':NumRej:'...Please account for all rejects.'\r\n end\r\n MsgInfo<mtext$> = Message\r\n Void = msg( '', MsgInfo )\r\nend\r\nRETURN 0"
|
|
}
|
|
}
|
|
} |