EXPORT TO MACOLA

Transfer to Macola Menu

16.13.1 Overview

16.13.2 Installing pc/MRP's Transfer to Macola Module

16.13.3 Setting Transfer Default Settings and Directories

16.13.3 Transferring invoice (AR) information to Macola

16.13.4 Exporting invoice (AR) information to Macola Pseudo Code

    
    Restore last batch number from ar2macla.mem store it to MOLDBATCH
    If pc/MRP's Invoice.dbf file has a higher batch number, store it instead
    Increment the batch number and store it in M_AR_BATCH
    Check and or create the ARSLSDST.DBF and ARSLSTRX.DBF files
    Select the Invoice.dbf file 
    Replace invoice batchno field with M_AR_BATCH for all invoices with no batch#
    Create a cursor TEMPINV.DBF file (contains all invoice records new batch#)
    If there are no records in tempinv, it display message and quits
    Save the new batchno to the AR2MACLA.MEM file
    Zap the ARSLSTRX.DBF and ARSLSDST.DBF files 
    Store the batch number left padded with 0s (10 char total) in MBATCHSTR 
    
    Fill the ARSLSTRX.DBF and ARSLSDST.DBF files with the following information
    
    Select TEMPINV
    Do while not end of file
      STORE 0 TO MDUE, MFEXT, MFTOT, MFDISCTOT, MFTAXTOT, MFFRTTOT,;
                 MFPAIDTOT, MFITEMTOT, MPOTOTCOST, MCOMMISS, MCOMMTOT
      MDOCNO     = invoice number from tempinv,8 char,padded left with 0s
      MTERMS     = terms, 3 char, numeric only from tempinv or if empty put in 30
      MSLSMANNO  = salesman id numeric only from tempinv
      MINVOICENO = invoice number from tempinv
      MDOC_TP    = document type, 1 char, I = invoice C = credit memo 
      MCUS_NO    = customer acct# from tempinv, 12 char,padded left with 0s
      MCUS_NAME  = customers name from tempinv, 30 char
      MDOC_DT    = invoice date from tempinv, 8 char, yyyymmdd
      MDUE_DATE  = invoice date to be paid (invoice date + terms),8 char,yyyymmdd
      MTAX_CODE  = tax id code, 3 char from tempinv
      MCUSTPONO  = customer PO number from tempinv
      MTAXR	     = numeric taxrate from tempinv
      Do while MINVOICENO == UPPER(TEMPINV.INVOICENO)
        MAIN_NO = 0 + first 4 char of partmast dacct or default part acct  + 0000
        SUB_NO = 0 + char 5,6 from partmast dacct or default part acct# + 00000
        DP_NO = 0 + char 7,8 from partmast dacct or default part acct# + 00000
        Add the line item totals to the running invoice totals (DO CALCITEM)
        APPEND a distribution record for the part number to ARSLSDST.DBF, replace
          DOC_NO (8 char)     with MDOCNO (invoice number, with leading 0s)
          DOC_TP (1 char)     with MDOC_TP (doc type,I=invoice,C=credit memo)
          MAIN_NO (8 char)    with MMAINNO (chart of acct # for part invoiced)
          SUB_NO (8 char)     with MSUBNO (sub chart of acct # for part invoiced) 
          DP_NO (8 char)      with MDPNO (dept chart of acct # for part invoiced)
          DOC_AMT (15 char)   with amt-discount-commission,pad left with 0s + ' '
          JOB_NO (12 char)    with blanks
          CUR_CODE (3 char)   with blanks
          ORGTRX_RT (13 char) with '00000.000000 '
          CURTRX_RT (13 char) with '00000.000000 '
          FILLER (50 char)    with blanks
      Enddo   
      If taxes were charged (MFTAXTOT # 0)
        MAIN_NO = 000 + first 4 char of default tax acct# (M_AR_TAX) + 0
        SUB_NO =  000000 + char 5,6 from default tax acct# 
        DP_NO =   000000 + char 7,8 from default tax acct#
        APPEND a distribution record for the taxes to ARSLSDST.DBF, replace    
          DOC_NO (8 char)     with MDOCNO (invoice number, with leading 0s)
          DOC_TP (1 char)     with MDOC_TP (doc type,I=invoice,C=credit memo)
          MAIN_NO (8 char)    with MMAINNO (chart of acct # for tax invoiced)
          SUB_NO (8 char)     with MSUBNO (sub chart of accts # for tax) 
          DP_NO (8 char)      with MDPNO  (dept chart of accts # for tax)
          DOC_AMT (15 char)   with MFTAXTOT tax amt,rounded,pad left with 0s + ' '
          JOB_NO (12 char)    with blanks
          CUR_CODE (3 char)   with blanks
          ORGTRX_RT (13 char) with '00000.000000 '
          CURTRX_RT (13 char) with '00000.000000 '
          FILLER (50 char)    with blanks
      ELSE 
        MTAX_CODE='NT1'  (Macola's code for no tax)    
      ENDIF 
      If freight was charged (MFFRTTOT # 0)
        MAIN_NO = 000 + first 4 char of default freight acct# (M_AR_FREHT) + 0
        SUB_NO =  000000 + char 5,6 from default freight acct# 
        DP_NO =   000000 + char 7,8 from default freight acct#
        APPEND a distribution record for the freight to ARSLSDST.DBF, replace    
          DOC_NO (8 char)     with MDOCNO (invoice number, with leading 0s)
          DOC_TP (1 char)     with MDOC_TP (doc type,I=invoice,C=credit memo)
          MAIN_NO (8 char)    with MMAINNO (chart of acct # for freight)
          SUB_NO (8 char)     with MSUBNO  (sub chart of acct # for freight) 
          DP_NO (8 char)      with MDPNO   (dept chart of acct # for freight)
          DOC_AMT (15 char)   with MFFRTTOT frght amt,rounded,pad left with 0s + ' '
          JOB_NO (12 char)    with blanks
          CUR_CODE (3 char)   with blanks
          ORGTRX_RT (13 char) with '00000.000000 '
          CURTRX_RT (13 char) with '00000.000000 '
          FILLER (50 char)    with blanks
      Endif
      If commissions were involved (MCOMMTOT # 0)
        MAIN_NO = 000 + first 4 char of default commission acct# (M_AR_COMM)+ 0
        SUB_NO =  000000 + char 5,6 from default commission acct# 
        DP_NO =   000000 + char 7,8 from default commission acct#
        APPEND a distribution record for the commission to ARSLSDST.DBF, replace   
          DOC_NO (8 char)     with MDOCNO (invoice number, with leading 0s)
          DOC_TP (1 char)     with MDOC_TP (doc type,I=invoice,C=credit memo)
          MAIN_NO (8 char)    with MMAINNO (chart of accts number for commission)
          SUB_NO (8 char)     with MSUBNO  (sub chart of acct # for commission) 
          DP_NO (8 char)      with MDPNO   (dept chart of acct# for commission)
          DOC_AMT (15 char)   with MFFRTTOT commiss amt,rounded,pad left with 0s + ' '
          JOB_NO (12 char)    with blanks
          CUR_CODE (3 char)   with blanks
          ORGTRX_RT (13 char) with '00000.000000 '
          CURTRX_RT (13 char) with '00000.000000 '
          FILLER (50 char)    with blanks
      Endif
    
      Append a transaction record of the invoice to ARSLSTRX.DBF and replace 
        DOC_NO (8 char)      WITH  MDOCNO
        DOC_TP (1 char)      WITH  MDOC_TP
        BATCH_ID (10 char)   WITH  MBATCHSTR
        SRH_DOC_NO (8 char)  WITH  MDOCNO
        BAT_ID_ALT (10 char) WITH  MBATCHSTR
        CURR_CODE (3 char)
        DOC_NO_ALT (8 char)  WITH  MDOCNO
        CUS_NO (12 char)     WITH  MCUS_NO
        CUS_NAME (40 char)   WITH  MCUS_NAME
        DOC_DT (8 char)      WITH  MDOC_DT      
        APPLY_TO (8 char)    WITH  MDOCNO
        DUE_DT (8 char)      WITH  MDUE_DATE
        SALES_AMT (16 char)  WITH  amt-discount-commiss,left pad with 0s + ' '
        MISC_AMT (16 char)   WITH  '000000000000.00 '
        TAX_AMT1 (16 char)   WITH  tax total, left padded with 0s + ' '
        TAX_CD1 (3 char)     WITH  MTAX_CODE
        TAX_AMT2 (16 char)   WITH  '000000000000.00 '
        TAX_CD2 (3 char)   
        TAX_AMT3 (16 char)   WITH  '000000000000.00 '
        TAX_CD3 (3 char)   
        FREIGH_AMT (16 char) WITH  freight total,pad left with 0s + ' '
        TERM_CD (3 char)     WITH  MTERMS
        COST_AMT (15 char)   WITH  po cost total,pad left with 0s + ' '
        SLM_NO (3 char)      WITH  MSLSMANNO
        COMM_AMT (16 char)   WITH  commission total,pad left with 0s + ' '
        SALES_REF (30 char)  WITH  'CUST PO#: '+MCUSTPONO
        COMPLETE (1 char)    WITH  "Y"
        USER_NAME (10 char)  WITH  "SUPERVISOR"
        ORG_TAX_RT (13 char) WITH '00000.000000 '
        CUR_TAX_RT (13 char) WITH '00000.000000 '
        AMT_TAXED (16 char)  WITH ARSLSTRX.SALES_AMT or '000000000000.00 ' 
        TAX_SCHED (5 char)
        FILLER_001 (100 char)
    Enddo (Continue processing each invoice in  TEMPINV.DBF until)
     
    
    Consolidate distributions of the same chart of account to a single record per invoice
    Delete the backup batch files if they exist ARSLDST.BAK and ARSLSTRX.BAK
    make backups of the last batch ARSLDST.BAK and ARSLSTRX.BAK
    copy the ARSLSTRX.DBF file to an ascii SDF type file named ARSLSTRX.TXT
    copy the ARSLSDST.DBF file to an ascii SDF type file named ARSLSDST.TXT