Select NEW_BILLS LOCAL iPSFILE as Character LOCAL oPSFILE as Character Scan && Scans for New_bills up to EOF() *Define Variables iPSFILE=Alltrim(Fullpath) LSPECIALTHREE=.T. DINVOICEDATE=Ctod('15/08/2100') oPSFILE=Alltrim(NEWPATH) DO Compr WITH iPSFILE,oPSFILE ENDSCAN ********************************************************************************************************************************************************************************************************************************************************* Update Final Page Calculation in New_bills Replace All MP_ORG With 1,; SP_ORG With TP_ORG-1,; MP_CHG With 1,; SP_CHG With TP_CHG-1; ,SAVINGS With TP_ORG-TP_CHG Sum MP_ORG To MPCOUNT Sum SP_ORG To SPCOUNT_ORG Sum SP_CHG To SPCOUNT_CHG Wait Clear ********************************************************************************************************************************************************************************************************************************************************* PROCEDURE Compr PARAMETERS iPSFILE,oPSFILE Create Cursor BILLCOMPRESS (POS C(254)) && Create Temporary Cursor Billcompress to Check Page Numbers,Compressed File and Invoice Date. Select BILLCOMPRESS Append From (m.iPSFILE) Sdf && Appends in Standard Data Format *Count Number of Pages in PS File Go 4 LNPAGECOUNT = Val(Getwordnum(POS, Getwordcount(POS) - 0)) && Counts the Number of Initial Pages in PS File ********************************************************************************************************************************************************************************************************************************************************** *Check Whether The user is Licensed Holder or Not Locate For Alltrim(Strextract(POS,'(',')'))='Bhopal Telecom District' && Locates that whether Bhopal Telecom District is in the Bill or Not If Found() CLICENSEHOLDER=.T. && The User is a Valid License Holder Else CLICENSEHOLDER=.F.&& The User is a Not a Valid License Holder Endif ********************************************************************************************************************************************************************************************************************************************************** *Check For The Invoice Date. It will Be Used to Give DEMO Version of The Software For Limited Period Locate For Left(Strextract(POS,'(',''),12)='Invoice Date' && Locates for Text Invoice Date If Found() DINVIOCEDATE=Ctod(Right(Strextract(POS,'(',')'),10)) If DINVIOCEDATE<Ctod('31/08/2013') LDATE=.T. Else LDATE=.F. Endif Else LDATE=.F. Endif ********************************************************************************************************************************************************************************************************************************************************** Use In BILLCOMPRESS && De Select Billcompress ********************************************************************************************************************************************************************************************************************************************************** *PROGRAM RE-STARTS FORM HERE ********************************************************************************************************************************************************************************************************************************************************** CLICENSEHOLDER=.T. && Temporary LDATE=.T. If m.LDATE=.T. And m.CLICENSEHOLDER=.T. && IF the file not compressed and Date is Valid than we Can Start Compression Select NEW_BILLS *For Page Equal to One If LNPAGECOUNT=1 Create Cursor BILLCOMPRESS (PS C(254)) Append From (m.iPSFILE) Sdf Locate For Alltrim(PS)='%%Page: 1 1' If Found() Skip Replace PS With '<</Duplex false>> setpagedevice' Insert Blank Replace PS With '<</Duplex false /PageSize [595 842] /Tumble false>> statusdict begin 0 setpapertray end' Endif Set Textmerge On Set Textmerge To (m.oPSFILE) Noshow Scan \\<< TRIM(PS) >> \ Endscan Set Textmerge To Set Textmerge Off Select NEW_BILLS Replace TP_ORG With 1, TP_CHG With 1 && Replace Total Number of Pages (Original) In Cursor New_bills Endif *************************************************************************************************************************************************************>Hi Harsh
LOCAL lcPSFILEPATH, lcNEWPATH >Select NEW_BILLS >Scan && Scans for New_bills up to EOF() >lcPSFILEPATH=Alltrim(NEW_BILLS.oldpath) >lcNEWPATH=Alltrim(NEW_BILLS.NEWPATH) > >DO Compress with m.lcPSFILEPATH, m.lcNEWPATH > >ENDSCAN>
PROCEDURE Compress >LPARAMETERS m.tcPSFILEPATH,m.tcNEWPATH >Create Cursor BILLCOMPRESS (POS C(254)) && Create Temporary Cursor Billcompress to Check Page Numbers,Compressed File and Invoice Date. >Select BILLCOMPRESS >WAIT WINDOW m.tcPSFILEPATH >WAIT WINDOW m.tcNEWPATH >Append From (m.tcPSFILEPATH) Sdf && Nothing is appeneded as I get .F. as value for m.tcPSFILEPATH >ENDPROC>
>LOCAL m.lcPSFILEPATH, m.lcNEWPATH >Create Cursor BILLCOMPRESS (POS C(254)) && Create Temporary Cursor Billcompress to Check Page Numbers,Compressed File and Invoice Date. >Select NEW_BILLS >Scan > lcPSFILEPATH=Alltrim(NEW_BILLS.oldpath) > lcNEWPATH=Alltrim(NEW_BILLS.NEWPATH) > SELECT BILLCOMPRESS > Append From (m.lcPSFILEPATH) Sdf > DO Compress with m.lcPSFILEPATH, "BILLCOMPRESS", RECNO("BILLCOMPRESS") >ENDSCAN > >PROCEDURE Compress >LPARAMETERS m.tcPSFILEPATH, m.tcAlias, m.tnRec >SELECT (m.tcAlias) >GO m.tnRec >*Process the POS field. >ENDPROC>
>LOCAL m.lcPSFILEPATH, m.lcNEWPATH >Create Cursor BILLCOMPRESS (POS C(254)) && Create Temporary Cursor Billcompress to Check Page Numbers,Compressed File and Invoice Date. >Select NEW_BILLS >Scan > lcPSFILEPATH=Alltrim(NEW_BILLS.oldpath) > lcNEWPATH=Alltrim(NEW_BILLS.NEWPATH) > SELECT BILLCOMPRESS > Append From (m.lcPSFILEPATH) Sdf >ENDSCAN >DO Compress with m.lcPSFILEPATH, "BILLCOMPRESS" > >PROCEDURE Compress >LPARAMETERS m.tcPSFILEPATH, m.tcAlias >SELECT (m.tcAlias) >SCAN >*Process the POS field. >ENDSCAN >ENDPROC>
>>Select NEW_BILLS >>LOCAL cPSFILEPATH as Character >>LOCAL cNEWPATH as Character >> >>Scan && Scans for New_bills up to EOF() >>*Define Variables >>cPSFILEPATH=Alltrim(oldpath) >>cNEWPATH=Alltrim(NEWPATH) >>DO Compress >>ENDSCAN >> >>PROCEDURE Compress >>PARAMETERS cPSFILEPATH,cNEWPATH >>Create Cursor BILLCOMPRESS (POS C(254)) && Create Temporary Cursor Billcompress to Check Page Numbers,Compressed File and Invoice Date. >>Select BILLCOMPRESS >>WAIT WINDOW cPSFILEPATH >>WAIT WINDOW cNEWPATH >>Append From (m.cPSFILEPATH) Sdf && Nothing is appeneded as I get .F. as value for cPSFILEPATH >>ENDPROC >> >>