home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0020 - 0029 / ibm0020-0029 / ibm0028.tar / ibm0028 / SBTAR4.ZIP / ARPOSE.PRG < prev    next >
Encoding:
Text File  |  1990-06-04  |  19.7 KB  |  616 lines

  1. ********************** ' MultiNet Source Code ' ***********************
  2. ** '                       SBT Corporation                         ' **
  3. ** '         One Harbor Drive, Sausalito, California 94965         ' **
  4. ** '                   Telephone (415) 331-9900                    ' **
  5. ***********************************************************************
  6. ** '   (c) Copyright 1984, Revisions 1985 - 1990 SBT Corporation   ' **
  7. ** '            All Rights Reserved by SBT Corporation             ' **
  8. ** '                                                               ' **
  9. ***********************************************************************
  10. ** ' 06/04/90 = Last Update  **  ARPOSE.PRG   **   Version 6.35.00 ' **
  11. ***********************************************************************
  12. * ' Revise current Invoice/Credit Memo - called by ARPOST, calls SYSIDSP
  13. *
  14. * ' Passed variables: minvoice, mcust, mform, mcompany, minvamt,
  15. * '                   mtax, tinvt, tminvt
  16. *
  17. * ' Returns variable: mdone = 'S' to save Invoice
  18. * '                           'A' to add more items
  19. * '                           'C' to cancel Invoice
  20. *
  21. * ' Assumes files open:  Area A: ARCUSTnn
  22. * ' with indexes active  Area B: ARINVTnn
  23. * '                      Area C: Temporary File for this Invoice
  24. * '                      Area D: ARGLACnn if AR linked to GL
  25. *
  26. * ' Internal Variables: mfirst      = .t. if on first screen
  27. * '                     mlast       = .t. if on last screen
  28. * '                     mxpgrecno   = rec # for top of screen
  29. *
  30. PRIVATE merase, mline
  31. SET ESCAPE OFF
  32. STORE 1 TO mxpgrecno
  33. STORE .t. TO merase
  34. DO WHILE .t.
  35.   SELECT c
  36.   IF merase
  37.     CLEAR
  38.     @ 1,0 SAY 'Edit Detail of Current ' + mform
  39.     @ 2,0 SAY 'Customer Number / Name ' + SUBSTR(m0border,183,4) + ;
  40.     TRIM(mcust) + ' / ' + TRIM(mcompany)
  41.     @ 3,0 SAY 'Ln# ' + SUBSTR(m0border,91,4) + ' Item ' + ;
  42.     SUBSTR(m0border,91,5) + '  ' + SUBSTR(m0border,91,9) + ;
  43.     '  Description  ' + SUBSTR(m0border,91,11) + '  Disc %  Tax'
  44.     IF SUBSTR(m0link,1,1) = 'Y'
  45.       @ 3,70 SAY 'Sales/Cost'
  46.     ENDIF
  47.     DO CASE
  48.       CASE minvoice .AND. m0lntax
  49.         @ 4,3 SAY 'Order Qty    Ship Qty       Unit Cost   Unit Price  ' + ;
  50.         '           Extended Price'
  51.       CASE .NOT. minvoice .AND. mtxonly = 'N' .AND. m0lntax
  52.         @ 4,12 SAY 'Returned Qty       Unit Cost   Unit Price  ' + ;
  53.         '           Extended Price'
  54.       CASE minvoice
  55.         @ 4,3 SAY 'Order Qty    Ship Qty       Unit Cost   Unit Price  ' + ;
  56.         '           Extended Price'
  57.       CASE .NOT. minvoice .AND. mtxonly = 'N'
  58.         @ 4,12 SAY 'Returned Qty       Unit Cost   Unit Price  ' + ;
  59.         '           Extended Price'
  60.       CASE .NOT. minvoice .AND. mtxonly = 'Y'
  61.         @ 4,12 SAY 'Returned Qty       Unit Cost   Unit Price  ' + ;
  62.         'Tax Credt  Extended Price'
  63.     ENDCASE
  64.     @ 5,0 SAY SUBSTR(m0border,10,80)
  65.     GO TOP
  66.     IF RECNO() = mxpgrecno
  67.       STORE .t. TO mfirst
  68.     ELSE
  69.       STORE .f. TO mfirst
  70.     ENDIF
  71.     GO BOTTOM
  72.     IF RECNO() < mxpgrecno .OR. mdetcount = 0
  73.       GO TOP
  74.       STORE 1 TO mxpgrecno
  75.     ELSE
  76.       GO mxpgrecno
  77.     ENDIF
  78.     STORE LTRIM(STR(mxpgrecno,3,0)) TO spagerecno
  79.     @ 6,0 CLEAR
  80.     STORE 6 TO mline
  81.     STORE 0 TO mgroup
  82.     DO WHILE mline < 22 .AND. .NOT. EOF()
  83.       SELECT b
  84.       SEEK c->item
  85.       SELECT c
  86.       STORE STR(AT(STR(b->decnum,1,0),'123'),1,0) TO mxdec
  87.       STORE mdecimal&mxdec TO mpict
  88.       @ mline,0 SAY RECNO() PICTURE '999'
  89.       @ mline,4 SAY c->item
  90.       @ mline,21 SAY c->descrip
  91.       @ mline,57 SAY c->disc PICTURE '###.###'
  92.       IF m0lntax
  93.         @ mline,67 SAY c->taxcode PICTURE '!'
  94.       ELSE
  95.         @ mline,67 SAY c->taxable PICTURE 'Y'
  96.       ENDIF
  97.       IF SUBSTR(m0link,1,1) = 'Y'
  98.         @ mline,72 SAY c->glsale + '/' + c->glasst
  99.       ENDIF
  100.       IF minvoice
  101.         @ mline + 1,2 SAY c->qtyord PICTURE "&mpict"
  102.         @ mline + 1,16 SAY c->qtyshp PICTURE "&mpict"
  103.       ELSE
  104.         @ mline + 1,16 SAY 0 - c->qtyshp PICTURE "&mpict"
  105.       ENDIF
  106.       @ mline + 1,29 SAY c->cost PICTURE '#######.###'
  107.       @ mline + 1,43 SAY c->price PICTURE '#######.##'
  108.       @ mline + 1,67 SAY c->extprice PICTURE '999999999.99'
  109.       CLEAR GETS
  110.       STORE mgroup + 1 TO mgroup
  111.       STORE mline + 2 TO mline
  112.       SKIP
  113.     ENDDO && WHILE mline < 22 .AND. .NOT. EOF()
  114.     IF EOF()
  115.       STORE .t. TO mlast
  116.     ELSE
  117.       STORE .f. TO mlast
  118.     ENDIF
  119.     @ 22,0 CLEAR
  120.     @ 23,0 SAY 'Subtotal =                     Tax =            ' + ;
  121.     '       Total ='
  122.     * ' minvamt does not include extended tax if not using line item tax
  123.     @ 23,14 SAY minvamt - mtax PICTURE '99,999,999.99'
  124.     @ 23,38 SAY mtax PICTURE '9,999,999.99'
  125.     @ 23,66 SAY minvamt PICTURE '99,999,999.99'
  126.     STORE .f. TO merase
  127.   ENDIF && merase
  128.   STORE 'A' TO mdone
  129.   DO CASE
  130.     CASE mgroup = 0 .AND. .NOT. mfirst .AND. mlast
  131.       STORE '(Add/Back/Cancel)' TO msg
  132.       STORE 'ABC' TO moptns
  133.     CASE mgroup = 0 .AND. mfirst .AND. mlast
  134.       STORE '(Add/Cancel)' TO msg
  135.       STORE 'AC' TO moptns
  136.     CASE mgroup > 0 .AND. .NOT. mfirst .AND. .NOT. mlast
  137.       STORE '(Add/Edit line/Delete line/Inquiry/Fwd/Back/Save/Cancel)' TO msg
  138.       STORE 'AEDIFBSC' TO moptns
  139.     CASE mgroup > 0 .AND. mfirst .AND. .NOT. mlast
  140.       STORE '(Add/Edit line/Delete line/Inquiry/Fwd/Save/Cancel)' TO msg
  141.       STORE 'AEDIFSC' TO moptns
  142.     CASE mgroup > 0 .AND. .NOT. mfirst .AND. mlast
  143.       STORE '(Add/Edit line/Delete line/Inquiry/Back/Save/Cancel)' TO msg
  144.       STORE 'AEDIBSC' TO moptns
  145.     OTHERWISE
  146.       STORE '(Add/Edit line/Delete line/Inquiry/Save/Cancel)' TO msg
  147.       STORE 'AEDISC' TO moptns
  148.   ENDCASE
  149.   @ 22,0 SAY 'Enter Choice ' + msg + ' ' + SUBSTR(m0border,180,7) ;
  150.   GET mdone PICTURE '!'
  151.   READ SAVE
  152.   DO WHILE .NOT. mdone $ moptns
  153.     ?? CHR(7)
  154.     READ SAVE
  155.   ENDDO
  156.   @ 22,0
  157.   CLEAR GETS
  158.   IF mdone $ 'ASC'
  159.     STORE SPACE(15) TO mitem
  160.     RETURN
  161.   ENDIF
  162.   IF mdone = 'B'
  163.     GO mxpgrecno
  164.     STORE 0 TO mcount
  165.     DO WHILE mcount < 8 .AND. .NOT. BOF()
  166.       STORE mcount + 1 TO mcount
  167.       SKIP -1
  168.     ENDDO
  169.     IF BOF()
  170.       STORE .t. TO mfirst
  171.       GO TOP
  172.     ENDIF
  173.     STORE RECNO() TO mxpgrecno
  174.     STORE .t. TO merase
  175.     LOOP
  176.   ENDIF
  177.   IF mdone = 'F'
  178.     STORE RECNO() TO mxpgrecno
  179.     STORE .t. TO merase
  180.     LOOP
  181.   ENDIF && mdone = 'I'
  182.   IF mdone = 'I'
  183.     STORE 0 TO seqno
  184.     STORE LTRIM(STR(mgroup + mxpgrecno - 1,3,0)) TO send
  185.     IF mgroup > 1
  186.       @ 22,1 SAY 'Enter Line Number to Inquire (' + spagerecno + '-' + ;
  187.       send + ') ' + SUBSTR(m0border,180,7) GET seqno PICTURE '###'
  188.       READ
  189.       IF seqno < mxpgrecno .OR. seqno > mgroup + mxpgrecno - 1
  190.         @ 22,0
  191.         LOOP
  192.       ENDIF
  193.     ELSE
  194.       STORE mxpgrecno TO seqno
  195.     ENDIF
  196.     @ 22,0
  197.     SELECT c
  198.     GO seqno
  199.     IF EOF()
  200.       LOOP
  201.     ENDIF
  202.     STORE (seqno - mxpgrecno) * 2 + 6 TO mxline
  203.     STORE c->item TO mitem
  204.     SELECT b
  205.     SEEK mitem
  206.     * ' Display item record
  207.     DO sysidsp
  208.     SELECT c
  209.     STORE .t. TO merase
  210.     LOOP
  211.   ENDIF
  212.   IF mdone = 'D'
  213.     STORE 0 TO seqno
  214.     STORE LTRIM(STR(mgroup + mxpgrecno - 1,3,0)) TO send
  215.     IF mgroup > 1
  216.       @ 22,0 SAY 'Enter Line Number to Delete (' + spagerecno + '-' + ;
  217.       send + ') ' + SUBSTR(m0border,180,7) GET seqno PICTURE '###'
  218.       READ
  219.       IF seqno < mxpgrecno .OR. seqno > mgroup + mxpgrecno - 1
  220.         @ 22,0
  221.         LOOP
  222.       ENDIF
  223.     ELSE
  224.       STORE mxpgrecno TO seqno
  225.     ENDIF
  226.     @ 22,0
  227.     SELECT c
  228.     GO seqno
  229.     IF EOF()
  230.       LOOP
  231.     ENDIF
  232.     STORE .t. TO merase
  233.     STORE (seqno - mxpgrecno) * 2 + 6 TO mxline
  234.     STORE c->item TO mitem
  235.     SELECT b
  236.     SET INDEX TO &m0invtf..ndx
  237.     SEEK mitem
  238.     SELECT c
  239.     STORE STR(AT(STR(b->decnum,1,0),'123'),1,0) TO mxdec
  240.     STORE mdecimal&mxdec TO mpict
  241.     STORE RECNO() TO mrecno
  242.     * ' display line in reverse video
  243.     @ mxline,0 GET mrecno PICTURE '999'
  244.     @ mxline,4 GET c->item
  245.     @ mxline,21 GET c->descrip
  246.     @ mxline,57 GET c->disc PICTURE '###.###'
  247.     IF m0lntax
  248.       @ mxline,67 SAY c->taxcode PICTURE '!'
  249.     ELSE
  250.       @ mxline,67 SAY c->taxable PICTURE 'Y'
  251.       STORE c->taxable TO itaxcode
  252.     ENDIF
  253.     IF SUBSTR(m0link,1,1) = 'Y'
  254.       @ mxline,72 GET c->glsale
  255.       @ mxline,75 SAY '/'
  256.       @ mxline,76 GET c->glasst
  257.     ENDIF
  258.     IF minvoice
  259.       @ mxline + 1,2 GET c->qtyord PICTURE "&mpict"
  260.       @ mxline + 1,16 GET c->qtyshp PICTURE "&mpict"
  261.     ELSE
  262.       STORE 0 - c->qtyshp TO iqtyshp
  263.       @ mxline + 1,16 GET iqtyshp PICTURE "&mpict"
  264.     ENDIF       
  265.     @ mxline + 1,29 GET c->cost PICTURE '#######.###'
  266.     @ mxline + 1,43 GET c->price PICTURE '#######.##'
  267.     @ mxline + 1,67 GET c->extprice PICTURE '999999999.99'
  268.     CLEAR GETS
  269.     ?? CHR(7)
  270.     STORE 'N' TO mans
  271.     @ 22,0 SAY 'Are you sure you want to Delete this Line ? (Y/N) ' + ;
  272.     SUBSTR(m0border,181,7) GET mans PICTURE 'Y'
  273.     READ
  274.     IF mans = 'Y'
  275.       * ' delete line and pack file
  276.       SELECT b
  277.       @ 22,0
  278.       @ 22,0 SAY '*****  Updating Inventory File  *****'
  279.       SET INDEX TO &m0invtf..ndx
  280.       SEEK mitem
  281.       DO p0rlockn
  282.       REPLACE ptdqty WITH ptdqty - c->qtyshp, ytdqty WITH ytdqty - ;
  283.       c->qtyshp, ptdsls WITH ptdsls - c->extprice, ytdsls WITH ;
  284.       ytdsls - c->extprice
  285.       STORE f0extlin(c->qtyshp, c->cost, 0) TO iextcost
  286.       IF b->stkcode = 'Y'
  287.         REPLACE onhand WITH onhand + c->qtyshp
  288.         STORE tinvt - iextcost TO tinvt
  289.       ELSE
  290.         STORE tminvt - iextcost TO tminvt
  291.       ENDIF
  292.       UNLOCK
  293.       SELECT c
  294.       @ 22,0
  295.       @ 22,0 SAY '*****  Updating Temporary Detail File  *****'
  296.       DO p0linclc WITH 'D', minvsub, mtax, minvamt, -c->extprice, ;
  297.       itaxcode
  298.       DELETE
  299.       PACK
  300.       STORE mdetcount - 1 TO mdetcount
  301.     ENDIF && mans = 'Y'
  302.     @ 22,0
  303.     LOOP
  304.   ENDIF && mdone = 'D'
  305.   IF mdone = 'E'
  306.     STORE 0 TO seqno
  307.     STORE LTRIM(STR(mgroup + mxpgrecno - 1,3,0)) TO send
  308.     IF mgroup > 1
  309.       @ 22,0 SAY 'Enter Line Number to Edit (' + spagerecno + '-' + ;
  310.       send + ') ' + SUBSTR(m0border,180,7) GET seqno PICTURE '###'
  311.       READ
  312.       IF seqno < mxpgrecno .OR. seqno > mgroup + mxpgrecno - 1
  313.         @ 22,0
  314.         LOOP
  315.       ENDIF
  316.     ELSE
  317.       STORE mxpgrecno TO seqno
  318.     ENDIF
  319.     @ 22,0
  320.     SELECT c
  321.     GO seqno
  322.     IF EOF()
  323.       LOOP
  324.     ENDIF
  325.     STORE .t. TO merase
  326.     STORE (seqno - mxpgrecno) * 2 + 6 TO mxline
  327.     STORE c->item TO mitem
  328.     SELECT b
  329.     SET INDEX TO &m0invtf..ndx
  330.     SEEK mitem
  331.     SELECT c
  332.     STORE c->descrip TO idescrip
  333.     STORE c->price TO iprice
  334.     STORE c->cost TO icost
  335.     STORE c->qtyord TO iqtyord
  336.     STORE c->qtyshp TO iqtyshp
  337.     IF minvoice
  338.       STORE c->qtyord TO iqtyord
  339.       STORE c->qtyshp TO iqtyshp
  340.     ELSE
  341.       STORE 0 - c->qtyshp TO iqtyshp, iqtyord
  342.     ENDIF
  343.     STORE c->glasst TO iglasst
  344.     STORE c->glsale TO iglsale
  345.     STORE c->disc TO idisc
  346.     STORE c->taxable TO itaxable
  347.     STORE itaxable TO itaxcode
  348.     IF m0lntax
  349.       STORE c->taxcode TO itaxcode
  350.     ENDIF
  351.     STORE STR(AT(STR(b->decnum,1,0),'123'),1,0) TO mxdec
  352.     STORE mdecimal&mxdec TO mpict
  353.     STORE b->class TO iclass
  354.     @ 22,0 SAY 'On Hand ='
  355.     @ 22,10 SAY b->onhand PICTURE '##&mpict'
  356.     @ 22,27 SAY 'Allocated ='
  357.     @ 22,39 SAY b->aloc PICTURE '##&mpict'
  358.     @ 22,54 SAY 'Proj Stock ='
  359.     @ 22,67 SAY b->onhand + b->onorder - b->aloc PICTURE '##&mpict'
  360.     @ mxline,21 GET idescrip PICTURE 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
  361.     @ mxline,57 GET idisc PICTURE '###.###'
  362.     IF m0lntax
  363.       @ mxline,67 GET itaxcode PICTURE '!'
  364.       READ
  365.       DO WHILE .t.
  366.         IF itaxcode = ' '
  367.           STORE -1 TO itaxrate
  368.         ELSE
  369.           STORE f0taxval('rate', ASC(itaxcode) - 64) TO itaxrate
  370.           STORE f0taxval('acct', ASC(itaxcode) - 64) TO mtaxacct
  371.         ENDIF
  372.         IF itaxrate >= 0
  373.           EXIT
  374.         ENDIF
  375.         DO p0reget WITH .t., 22, 0, mxline, 67, itaxcode, '!', ;
  376.         'Invalid Tax Code. Please reenter...'
  377.       ENDDO
  378.       @ 22,0
  379.       STORE 'V' TO itaxable
  380.     ELSE
  381.       IF itaxrate = 0.00
  382.         STORE 'N' TO itaxable
  383.         @ mxline,67 SAY itaxable PICTURE 'Y'
  384.       ELSE
  385.         @ mxline,67 GET itaxable PICTURE 'Y'
  386.       ENDIF
  387.     ENDIF
  388.     IF SUBSTR(m0link,1,1) = 'Y'
  389.       @ mxline,72 GET iglsale PICTURE '!!!'
  390.       @ mxline,75 SAY '/'
  391.       @ mxline,76 GET iglasst PICTURE '!!!'
  392.     ENDIF
  393.     IF minvoice
  394.       @ mxline + 1,2 GET iqtyord PICTURE "&mpict"
  395.       @ mxline + 1,16 GET iqtyshp PICTURE "&mpict"
  396.     ELSE
  397.       @ mxline + 1,16 GET iqtyshp PICTURE "&mpict"
  398.     ENDIF
  399.     IF b->stkcode = 'N' .AND. minvoice
  400.       @ mxline + 1,29 GET icost PICTURE '#######.###'
  401.     ELSE
  402.       @ mxline + 1,29 SAY icost PICTURE '9999999.999'
  403.     ENDIF
  404.     IF (b->level3 > 0 .OR. b->level2 > 0) .AND. ipricecode = 'L'
  405.       READ
  406.       IF (iqtyord >= b->level3 .AND. b->level3 > 0) .OR. ;
  407.         (iqtyord >= b->level2 .AND. b->level2 > 0)
  408.         @ 22,0
  409.         STORE 'N' TO mans
  410.         @ 22,0 SAY 'New Order Qty changes Price Category. Use New ' + ;
  411.         'Price (Y/N) ' + SUBSTR(m0border,181,6) GET mans PICTURE 'Y'
  412.         READ
  413.         @ 22,0
  414.         DO CASE
  415.           CASE mans = 'Y' .AND. iqtyord >= b->level3 .AND. b->level3 > 0
  416.             STORE b->price3 TO iprice
  417.           CASE mans = 'Y' .AND. iqtyord >= b->level2 .AND. b->level2 > 0
  418.             STORE b->price2 TO iprice
  419.         ENDCASE
  420.       ENDIF
  421.     ENDIF
  422.     @ mxline + 1,43 GET iprice PICTURE '#######.##'
  423.     READ      
  424.     IF m0lookup
  425.       * ' Validate not over MAX values for QTY, COST, and PRICE in Lookup Table
  426.       STORE 'iqtyshp' TO mvqty
  427.       STORE 'icost' TO mvcost
  428.       STORE 'iprice' TO mvprice
  429.       STORE .t. TO num1ok, num2ok, num3ok
  430.       IF minvoice
  431.         @ mxline + 1,2 GET iqtyord PICTURE "&mpict"
  432.       ENDIF
  433.       @ mxline + 1,16 GET iqtyshp PICTURE "&mpict"
  434.       IF b->stkcode = 'N'
  435.         @ mxline + 1,29 GET icost PICTURE '#######.###'
  436.       ENDIF
  437.       @ mxline + 1,43 GET iprice PICTURE '#######.##'
  438.       CLEAR GETS
  439.       DO systblv WITH 'Maxclass', SUBSTR(m0comp,1,2), ;
  440.       'iclass', 'B', 22, .t.
  441.       IF .NOT. num1ok
  442.         ?? CHR(7)
  443.         IF minvoice
  444.           @ mxline + 1,2 GET iqtyord PICTURE "&mpict"
  445.         ENDIF
  446.         @ mxline + 1,16 GET iqtyshp PICTURE "&mpict"
  447.         @ 22,0 CLEAR
  448.         @ 22,0 SAY 'Qty Shipped is larger than Maximum Qty for this Class.'
  449.         @ 23,0 SAY 'Enter new Qty or press <Enter> to continue...'
  450.         READ
  451.       ENDIF
  452.       IF .NOT. num2ok .AND. b->stkcode = 'N'
  453.         ?? CHR(7)
  454.         @ mxline + 1,29 GET icost PICTURE '#######.###'
  455.         @ 22,0 CLEAR
  456.         @ 22,0 SAY 'Cost for item is larger than Maximum Cost for this Class.'
  457.         @ 23,0 SAY 'Enter new Cost or press <Enter> to continue...'
  458.         READ
  459.       ENDIF
  460.       IF .NOT. num3ok
  461.         ?? CHR(7)
  462.         @ mxline + 1,43 GET iprice PICTURE '#######.##'
  463.         @ 22,0 CLEAR
  464.         @ 22,0 SAY 'Price for item is larger than Maximum Price for ' + ;
  465.         'this Class.'
  466.         @ 23,0 SAY 'Enter new Price or press <Enter> to continue...'
  467.         READ
  468.       ENDIF
  469.       CLEAR GETS
  470.       @ 22,0 CLEAR
  471.     ENDIF && m0lookup
  472.     IF .NOT. minvoice
  473.       STORE 0 - iqtyshp TO iqtyshp, iqtyord
  474.     ENDIF
  475.     STORE f0extlin(iqtyshp, iprice, idisc) TO iextprice
  476.     IF mtxonly = 'Y' .AND. .NOT. minvoice
  477.       STORE 0.00 TO iextprice
  478.     ENDIF
  479.     @ mxline + 1,67 SAY iextprice PICTURE '999999999.99'
  480.     CLEAR GETS
  481.     IF icost > iprice
  482.       STORE ' ' TO mans
  483.       STORE 'Unit Cost greater than Unit Price.  Press any key to continue.';
  484.       TO mmsg
  485.       DO p0reget WITH .t., 22, 0, 22, LEN(mmsg) + 1, mans, '', mmsg
  486.     ENDIF
  487.     STORE 'Y' TO mans
  488.     @ 22,0
  489.     @ 22,0 SAY 'Save Changes for this Line ? (Y/N) ' + ;
  490.     SUBSTR(m0border,181,6) GET mans PICTURE 'Y'
  491.     READ
  492.     @ 22,0
  493.     IF mans = 'N'
  494.       LOOP
  495.     ENDIF
  496.     STORE .t. TO mok
  497.     IF SUBSTR(m0link,1,1) = 'Y'
  498.       SELECT d
  499.       SET INDEX TO &m0glacf..ndx
  500.       DO WHILE mok
  501.         SEEK iglsale
  502.         IF .NOT. (EOF() .OR. BOF())
  503.           EXIT
  504.         ENDIF
  505.         DO p0reget WITH .t., 22, 0, mxline, 72, iglsale, '!!!', 'Invalid ' + ;
  506.         'Ledger sales linking code.  Reenter or blanks to cancel...'
  507.         IF iglsale = '   '
  508.           STORE .f. TO mok
  509.         ENDIF
  510.       ENDDO
  511.       CLEAR GETS
  512.       DO WHILE mok
  513.         SEEK iglasst
  514.         IF .NOT. (EOF() .OR. BOF())
  515.           EXIT
  516.         ENDIF
  517.         DO p0reget WITH .t., 22, 0, mxline, 76, iglasst, '!!!', 'Invalid ' + ;
  518.         'Ledger inventory linking code.  Reenter or blanks to cancel...'
  519.         IF iglasst = '   '
  520.           STORE .f. TO mok
  521.         ENDIF
  522.       ENDDO
  523.       SELECT c
  524.     ENDIF && SUBSTR(m0link,1,1) = 'Y'
  525.     IF mok .AND. minvoice .AND. b->stkcode = 'Y' .AND. ;
  526.       b->onhand - b->aloc < iqtyshp - c->qtyshp
  527.       STORE 'Y' TO mans
  528.       ?? CHR(7)
  529.       @ 22,0 SAY 'Ship Qty = '
  530.       @ 22,12 SAY iqtyshp PICTURE '&mpict'
  531.       IF b->onhand - b->aloc + c->qtyshp > 0
  532.         @ 22,26 SAY 'On Hand Qty = '
  533.         @ 22,42 SAY b->onhand - b->aloc + c->qtyshp PICTURE '&mpict'
  534.       ELSE
  535.         @ 22,30 SAY 'Out Of Stock'
  536.       ENDIF
  537.       @ 22,55 SAY 'Continue ? (Y/N) ' + SUBSTR(m0border,181,6) ;
  538.       GET mans PICTURE 'Y'
  539.       READ
  540.       IF mans = 'N'
  541.         STORE .f. TO mok
  542.       ENDIF
  543.       @ 22,0
  544.     ENDIF
  545.     IF mok .AND. minvoice .AND. a->limit - a->balance - minvamt - ;
  546.       iextprice + c->extprice - (.01 * iextprice * itaxrate) < 0 ;
  547.       .AND. TRIM(mcust) <> 'CASH'
  548.       STORE 'Y' TO mans
  549.       ?? CHR(7)
  550.       STORE LTRIM(STR(a->balance + minvamt + iextprice - ;
  551.       c->extprice - (.01 * iextprice * itaxrate) - a->limit,12,2))  TO mamount
  552.       @ 22,0 SAY 'Credit limit exceeded by ' + mamount + ;
  553.       ', Continue ? (Y/N) ' + SUBSTR(m0border,181,6) GET mans PICTURE 'Y'
  554.       READ
  555.       IF mans = 'N'
  556.         STORE .f. TO mok
  557.       ENDIF
  558.       @ 22,0
  559.     ENDIF
  560.     IF .NOT. mok
  561.       LOOP
  562.     ENDIF
  563.     IF mtxonly = 'N'
  564.       SELECT b
  565.       @ 22,0
  566.       @ 22,0 SAY '*****  Updating Inventory File  *****'
  567.       SET INDEX TO &m0invtf..ndx
  568.       SEEK mitem
  569.       DO p0rlockn
  570.       REPLACE ptdqty WITH ptdqty + iqtyshp - c->qtyshp, ytdqty WITH ytdqty + ;
  571.       iqtyshp - c->qtyshp, ptdsls WITH ptdsls + iextprice - c->extprice, ;
  572.       ytdsls WITH ytdsls + iextprice - c->extprice
  573.       STORE f0extlin(c->qtyshp, c->cost, 0) TO ixextcost
  574.       STORE f0extlin(iqtyshp, icost, 0) TO iextcost
  575.       IF b->stkcode = 'Y'
  576.         REPLACE onhand WITH onhand - iqtyshp + c->qtyshp
  577.         STORE tinvt - ixextcost + iextcost TO tinvt
  578.       ELSE
  579.         STORE tminvt - ixextcost + iextcost TO tminvt
  580.       ENDIF
  581.       UNLOCK
  582.     ENDIF && mtxonly = 'N'
  583.     @ 22,0
  584.     @ 22,0 SAY '*****  Updating Temporary Detail File  *****'
  585.     SELECT c
  586.     IF .NOT. m0lntax
  587.       STORE itaxable TO itaxcode
  588.     ENDIF
  589.     * ' get changed price and tax; total doesnt include tax if not line item tax
  590.     DO p0linclc WITH 'E', minvsub, mtax, minvamt, iextprice, itaxcode
  591.     REPLACE qtyord WITH iqtyord, qtyshp WITH iqtyshp, descrip WITH ;
  592.     idescrip, glsale WITH iglsale, glasst WITH iglasst
  593.     REPLACE disc WITH idisc, cost WITH icost, price WITH iprice, ;
  594.     extprice WITH iextprice, taxable WITH itaxable
  595.     IF mtxonly = 'Y' .AND. .NOT. minvoice
  596.       STORE 'Tax Credit' TO iponum
  597.       REPLACE ponum WITH 'Tax Credit'
  598.     ENDIF
  599.     IF m0lntax
  600.       REPLACE taxrate WITH itaxrate, taxcode WITH itaxcode, ;
  601.       taxacct WITH mtaxacct
  602.     ELSE
  603.       REPLACE taxrate WITH IIF(taxable = 'Y' .OR. mtxonly = 'Y', itaxrate, 0.00)
  604.     ENDIF
  605.     @ 22,0
  606.   ENDIF && mdone = 'E'
  607. ENDDO && WHILE .t.
  608. RETURN
  609. *
  610. * ' $Revision:   1.25  $
  611. * ' $Date:   25 May 1990 16:20:50  $
  612. *********************
  613. ** ' ARPOSE.PRG  ' **
  614. ** ' 615 Lines   ' **
  615. *********************
  616.