11 lines
4.4 KiB
JSON
11 lines
4.4 KiB
JSON
{
|
|
"header": {
|
|
"version": 1,
|
|
"type": "record"
|
|
},
|
|
"body": {
|
|
"record1": {
|
|
"<1>": "declare function next_key, send_event, msg, security_check, admin_user\r\ndeclare function entid, repository\r\ndeclare subroutine security_err_msg, delete_row\r\n$insert security_rights_equ\r\n$insert invoice_equ\r\n$insert logical\r\n$insert lsl_users_equ\r\n$insert msg_equates\r\n\r\nContinue = false$\r\nif admin_user( @user4 ) then\r\n Continue = true$\r\nend else\r\n SecGroups = xlate( 'LSL_USERS', @user4, lsl_users_groups$, 'X' )\r\n locate 'SCHEDULING' in SecGroups using @vm setting Fpos then\r\n Continue = true$\r\n end\r\nend\r\nif Continue then\r\n\tif security_check( 'Invoice', Write$ ) then\r\n\t * save off all data\r\n \tPopupId = entid( @appid<1>, 'POPUP', '', 'INVOICE_MEMO_OPTS' )\r\n\t\tChoosenRow = repository( 'EXECUTE', PopupId, @window, '' )\r\n if ChoosenRow then\r\n if ChoosenRow = 1 then\r\n Prefix = 'CM'\r\n end else\r\n Prefix = 'DM'\r\n end\r\n\t\t AllControls = utility( 'OBJECTLIST', @window, '' )\r\n\t\t convert @fm to @rm in AllControls\r\n\t\t AllData = get_property( Allcontrols, 'TEXT' )\r\n\t\t InvoiceDetail = .invoice_detail->array\r\n\t\t RecToUse = ''\r\n\t\t RecToUse<invoice_order_line_item$> = InvoiceDetail<1>\r\n\t\t RecToUse<invoice_quote_ids$> = InvoiceDetail<2>\r\n\t\t RecToUse<invoice_schedule_ids$> = InvoiceDetail<3>\r\n\t\t RecToUse<invoice_wo$> = InvoiceDetail<4>\r\n\t\t RecToUse<invoice_part_num$> = InvoiceDetail<5>\r\n\t\t RecToUse<invoice_lot_num$> = InvoiceDetail<6>\r\n\t\t RecToUse<invoice_gl_acct$> = InvoiceDetail<7>\r\n\t\t RecToUse<invoice_setup_charge$> = iconv( InvoiceDetail<8>, 'MD2,$' )\r\n\t\t RecToUse<invoice_srp_charge$> = iconv( InvoiceDetail<9>, 'MD2,$' )\r\n\t\t RecToUse<invoice_quantity$> = InvoiceDetail<10>\r\n\t\t RecToUse<invoice_rejects$> = InvoiceDetail<11>\r\n\t\t RecToUse<invoice_unprocessed$> = InvoiceDetail<12>\r\n\t\t RecToUse<invoice_price$> = iconv( InvoiceDetail<13>, 'MD2,$' )\r\n\t\t RecToUse<invoice_check_no$> = ''\r\n\t\t RecToUse<invoice_check_date$> = ''\r\n\t\t RecToUse<invoice_check_amount$> = ''\r\n\t\t OrigInvNo = .invoice_no->text\r\n\t\t HoldBillToAddr = .bill_to_addr->array\r\n\t\t HoldShipToAddr = .ship_to_addr->array\r\n\t\t HoldTrackNo = .tracking_no->array\r\n\t\t\tChoice = send_event( @window, 'CLEAR' )\r\n\t\t\tif Choice = '' then\r\n\t\t\t * if choice has a value then the user has canceled \r\n\t\t Void = set_property( @window, '@AutoCreate', 1 ) ;* to enable the creation of a new record\r\n\t\t NewInvoiceKey = Prefix:OrigInvNo\r\n\t\t\t\t.invoice_no->text = NewInvoiceKey\r\n\t\t Void = send_event( @window:'.INVOICE_NO', 'GOTFOCUS' )\r\n\t\t\t\tVoid = send_event( @window:'.INVOICE_NO', 'LOSTFOCUS' )\r\n\t\t Void = send_event( @window, 'READ' )\t\t\r\n\t\t Void = set_property( AllControls, 'TEXT', AllData )\r\n\t\t\t\t.invoice_no->text = NewInvoiceKey\r\n\t\t\t\t.entry_date->text = oconv( date(), 'D2/' )\r\n\t\t\t\t.entry_id->text = oconv( @user4, '[XLATE_CONV,LSL_USERS*FIRST_LAST]' )\r\n\t\t\t\t.status->value = 'O'\r\n\t\t\t\tVoid = set_property( @window, 'RECORD', RecToUse )\r\n\t\t\t\tInvoiceDetail<14> = str( @vm, 3 )\r\n\t\t \t.invoice_detail->array = InvoiceDetail\r\n\t\t \t.check_detail->array = @vm:@vm:@vm:@fm:@vm:@vm:@vm:@fm:@vm:@vm:@vm\r\n\t\t\t\tVoid = send_event( @window:'.INVOICE_DETAIL', 'CALCULATE', 14 ) \t\t\r\n\t\t\t\tVoid = send_event( @window:'.TOT_SHIP_QTY', 'CALCULATE', 1 )\r\n\t\t\t Void = send_event( @window:'.TOT_SHIP_AMT', 'CALCULATE', 1 )\r\n\t\t \tVoid = send_event( @window:'.INVOICE_AMT', 'CALCULATE', 1 )\r\n\t\t\t\tVoid = send_event( @window:'.BALANCE', 'CALCULATE', 1 )\r\n\t\t .bill_to_addr->array = HoldBillToAddr\r\n\t\t .ship_to_addr->array = HoldShipToAddr\r\n\t\t .tracking_no->array = HoldTrackNo \r\n\t\t\t\t@@window->savewarn = 1\r\n\t\t end\r\n\t\tend\r\n\tend else\r\n\t security_err_msg( 'Invoice', Write$ )\r\n\tend\r\nend else\r\n MsgInfo = ''\r\n MsgInfo<mtext$> = 'You do not have proper security to create a Credit Memo.' \r\n MsgInfo<micon$> = 'H'\r\n Void = msg( '', MsgInfo )\r\nend\r\nRETURN 0"
|
|
}
|
|
}
|
|
} |