CodePaste Logo
New Snippet New Snippet Recent Snippets Recent Snippets My Snippets My Snippets Web Code Search Snippets Search
Sign inor Register
Language: FoxPro

RFQ mSendRFQ() - Cage not in Supplier table AND Buyer's initials not in Personne table

208 Views
Copy Code Show/Hide Line Numbers
SET EXCLUSIVE OFF
 
crfqno = INPUTBOX("Enter RFQ number.", "cRFQno", "")
 
IF EMPTY(crfqno)
    RETURN
ENDIF  
 
IF USED('csSupplier')
   USE IN csSupplier
ENDIF
 
Select *, 0 as sel ;
   From supplier ;
   WHERE !DELETED() ;
   Into Cursor csSupplier ReadWrite
 
IF USED('csRFQ1')
   USE IN csRFQ1
ENDIF
 
SELECT rfq.rfq, SUBSTR(UPPER(ALLTRIM(rfq.cage)),1,7) as cage, rfq.date_sent, rfq.date_expir, rfq.ven_quote, rfq.remarks,;
   rfq_det.part_no, rfq_det.ven_partno, rfq_det.rfq_qty, rfq.buyer, ;
   '        ' AS alpl_rev, '        ' AS draw_rev, '        ' AS spec_rev;
   FROM purchase!rfq inner JOIN purchase!rfq_det ;
   ON rfq.rfq == rfq_det.rfq ;
   WHERE !DELETED() AND rfq.rfq == crfqno ;
   INTO CURSOR csRFQ1 READWRITE      
 
IF USED('csRFQ2')
   USE IN csRFQ2
ENDIF
      
SELECT csRFQ1.*, cssupplier.comp_name, cssupplier.address, cssupplier.city, ;
   cssupplier.state, cssupplier.zip, cssupplier.supaddr1, cssupplier.supaddr2, ;
   cssupplier.supaddr3, cssupplier.supaddr4, cssupplier.supaddr5, ;
   cssupplier.contact, cssupplier.phone, cssupplier.fax, cssupplier.email;
   FROM csRFQ1 inner JOIN cssupplier ;
   ON SUBSTR(UPPER(ALLTRIM(csRFQ1.cage)),1,7) == SUBSTR(UPPER(ALLTRIM(cssupplier.cage)),1,7) ;
   INTO CURSOR csRFQ2
 
IF _tally = 0
   MESSAGEBOX("Cage " + ALLTRIM(csRFQ1.cage) + " is not in Supplier table; RFQ won't be sent", 48, "FYI")
    RETURN
ELSE
   MESSAGEBOX("Cage Found!", 64, "FYI")
ENDIF
   
IF USED("csRFQ2") AND RECCOUNT("csRFQ2") > 0 then
   
   IF USED('csPersonne')
      USE IN csPersonne
   ENDIF
   
   Select *, 0 as sel ;
      From personne ;
      WHERE !DELETED() AND terminated='N' ;
      Into Cursor csPersonne ReadWrite
 
   IF USED('csT1')
      USE IN csT1
   ENDIF
      
   SELECT ALLTRIM(initials);
      FROM csPersonne ;
      WHERE UPPER(ALLTRIM(csRFQ2.Buyer)) == UPPER(ALLTRIM(initials)) AND terminated = "N" INTO CURSOR csT1
   
   IF _tally = 0
      MESSAGEBOX("Buyer's initials " + ALLTRIM(csRFQ2.Buyer) + " are not in Personne table; RFQ won't be sent", 48, "FYI")
   ELSE
      MESSAGEBOX("Buyer's initials Found!", 64, "FYI")
   ENDIF
 
ENDIF
by vlad tamas
  April 12, 2010 @ 7:52am
Tags:

Add a comment


Report Abuse
brought to you by:
West Wind Techologies



If you find this site useful and use it frequently please consider making a donation to support this free service.
Donate