CREATE COLUMN TABLE "IMCYC"."OPDF" ("DocEntry" INTEGER CS_INT NOT NULL , "DocNum" INTEGER CS_INT, "DocType" CHAR(1) CS_FIXEDSTRING, "Canceled" CHAR(1) CS_FIXEDSTRING, "Handwrtten" CHAR(1) CS_FIXEDSTRING, "Printed" CHAR(1) CS_FIXEDSTRING DEFAULT 'N', "DocDate" LONGDATE CS_LONGDATE, "DocDueDate" LONGDATE CS_LONGDATE, "CardCode" NVARCHAR(15), "CardName" NVARCHAR(100), "Address" NVARCHAR(254), "DdctPrcnt" DECIMAL(21,6) CS_FIXED, "DdctSum" DECIMAL(21,6) CS_FIXED, "DdctSumFC" DECIMAL(21,6) CS_FIXED, "CashAcct" NVARCHAR(15), "CashSum" DECIMAL(21,6) CS_FIXED, "CashSumFC" DECIMAL(21,6) CS_FIXED, "CreditSum" DECIMAL(21,6) CS_FIXED, "CredSumFC" DECIMAL(21,6) CS_FIXED, "CheckAcct" NVARCHAR(15), "CheckSum" DECIMAL(21,6) CS_FIXED, "CheckSumFC" DECIMAL(21,6) CS_FIXED, "TrsfrAcct" NVARCHAR(15), "TrsfrSum" DECIMAL(21,6) CS_FIXED, "TrsfrSumFC" DECIMAL(21,6) CS_FIXED, "TrsfrDate" LONGDATE CS_LONGDATE, "TrsfrRef" NVARCHAR(27), "PayNoDoc" CHAR(1) CS_FIXEDSTRING DEFAULT 'N', "NoDocSum" DECIMAL(21,6) CS_FIXED, "NoDocSumFC" DECIMAL(21,6) CS_FIXED, "DocCurr" NVARCHAR(3), "DiffCurr" CHAR(1) CS_FIXEDSTRING DEFAULT 'N', "DocRate" DECIMAL(21,6) CS_FIXED, "SysRate" DECIMAL(21,6) CS_FIXED, "DocTotal" DECIMAL(21,6) CS_FIXED, "DocTotalFC" DECIMAL(21,6) CS_FIXED, "Ref1" NVARCHAR(8), "Ref2" NVARCHAR(8), "CounterRef" NVARCHAR(8), "Comments" NVARCHAR(254), "JrnlMemo" NVARCHAR(50), "TransId" INTEGER CS_INT, "DocTime" SMALLINT CS_INT, "ShowAtCard" CHAR(1) CS_FIXEDSTRING DEFAULT 'N', "SpiltTrans" CHAR(1) CS_FIXEDSTRING DEFAULT 'N', "CreateTran" CHAR(1) CS_FIXEDSTRING DEFAULT 'Y', "Flags" INTEGER CS_INT DEFAULT 0, "CntctCode" INTEGER CS_INT, "DdctSumSy" DECIMAL(21,6) CS_FIXED, "CashSumSy" DECIMAL(21,6) CS_FIXED, "CredSumSy" DECIMAL(21,6) CS_FIXED, "CheckSumSy" DECIMAL(21,6) CS_FIXED, "TrsfrSumSy" DECIMAL(21,6) CS_FIXED, "NoDocSumSy" DECIMAL(21,6) CS_FIXED, "DocTotalSy" DECIMAL(21,6) CS_FIXED, "ObjType" NVARCHAR(20), "StornoRate" DECIMAL(21,6) CS_FIXED, "UpdateDate" LONGDATE CS_LONGDATE, "CreateDate" LONGDATE CS_LONGDATE, "ApplyVAT" CHAR(1) CS_FIXEDSTRING DEFAULT 'N', "TaxDate" LONGDATE CS_LONGDATE, "Series" SMALLINT CS_INT, "confirmed" CHAR(1) CS_FIXEDSTRING DEFAULT 'N', "ShowJDT" CHAR(1) CS_FIXEDSTRING, "BankCode" NVARCHAR(30), "BankAcct" NVARCHAR(50), "DataSource" CHAR(1) CS_FIXEDSTRING DEFAULT 'N', "UserSign" SMALLINT CS_INT, "LogInstanc" INTEGER CS_INT DEFAULT 0, "VatGroup" NVARCHAR(8), "VatSum" DECIMAL(21,6) CS_FIXED, "VatSumFC" DECIMAL(21,6) CS_FIXED, "VatSumSy" DECIMAL(21,6) CS_FIXED, "FinncPriod" INTEGER CS_INT, "VatPrcnt" DECIMAL(21,6) CS_FIXED, "Dcount" DECIMAL(21,6) CS_FIXED, "DcntSum" DECIMAL(21,6) CS_FIXED, "DcntSumFC" DECIMAL(21,6) CS_FIXED, "DcntSumSy" DECIMAL(21,6) CS_FIXED, "SpltCredLn" CHAR(1) CS_FIXEDSTRING, "PrjCode" NVARCHAR(20), "PaymentRef" NVARCHAR(27), "Submitted" CHAR(1) CS_FIXEDSTRING DEFAULT 'N', "Status" CHAR(1) CS_FIXEDSTRING DEFAULT 'N', "PayMth" NVARCHAR(15), "BankCountr" NVARCHAR(3), "FreightSum" DECIMAL(21,6) CS_FIXED, "FreigtFC" DECIMAL(21,6) CS_FIXED, "FreigtSC" DECIMAL(21,6) CS_FIXED, "BoeAcc" NVARCHAR(15), "BoeNum" INTEGER CS_INT, "BoeSum" DECIMAL(21,6) CS_FIXED, "BoeSumFc" DECIMAL(21,6) CS_FIXED, "BoeSumSc" DECIMAL(21,6) CS_FIXED, "BoeAgent" NVARCHAR(32), "BoeStatus" CHAR(1) CS_FIXEDSTRING, "WtCode" NVARCHAR(4), "WtSum" DECIMAL(21,6) CS_FIXED, "WtSumFrgn" DECIMAL(21,6) CS_FIXED, "WtSumSys" DECIMAL(21,6) CS_FIXED, "WtAccount" NVARCHAR(15), "WtBaseAmnt" DECIMAL(21,6) CS_FIXED, "Proforma" CHAR(1) CS_FIXEDSTRING DEFAULT 'N', "BoeAbs" INTEGER CS_INT, "BpAct" NVARCHAR(15), "BcgSum" DECIMAL(21,6) CS_FIXED, "BcgSumFC" DECIMAL(21,6) CS_FIXED, "BcgSumSy" DECIMAL(21,6) CS_FIXED, "PIndicator" NVARCHAR(10) DEFAULT ' ', "PaPriority" CHAR(1) CS_FIXEDSTRING DEFAULT '6', "PayToCode" NVARCHAR(50), "IsPaytoBnk" CHAR(1) CS_FIXEDSTRING DEFAULT 'N', "PBnkCnt" NVARCHAR(3), "PBnkCode" NVARCHAR(30), "PBnkAccnt" NVARCHAR(50), "PBnkBranch" NVARCHAR(50), "WizDunBlck" CHAR(1) CS_FIXEDSTRING DEFAULT 'N', "WtBaseSum" DECIMAL(21,6) CS_FIXED, "WtBaseSumF" DECIMAL(21,6) CS_FIXED, "WtBaseSumS" DECIMAL(21,6) CS_FIXED, "UndOvDiff" DECIMAL(21,6) CS_FIXED, "UndOvDiffS" DECIMAL(21,6) CS_FIXED, "BankActKey" INTEGER CS_INT, "VersionNum" NVARCHAR(11), "VatDate" LONGDATE CS_LONGDATE, "TransCode" NVARCHAR(4), "PaymType" CHAR(1) CS_FIXEDSTRING DEFAULT 'N', "TfrRealAmt" DECIMAL(21,6) CS_FIXED, "CancelDate" LONGDATE CS_LONGDATE, "OpenBal" DECIMAL(21,6) CS_FIXED, "OpenBalFc" DECIMAL(21,6) CS_FIXED, "OpenBalSc" DECIMAL(21,6) CS_FIXED, "BcgTaxSum" DECIMAL(21,6) CS_FIXED, "BcgTaxSumF" DECIMAL(21,6) CS_FIXED, "BcgTaxSumS" DECIMAL(21,6) CS_FIXED, "TpwID" INTEGER CS_INT DEFAULT 0, "ChallanNo" NVARCHAR(32), "ChallanBak" NVARCHAR(60), "ChallanDat" LONGDATE CS_LONGDATE, "WddStatus" CHAR(1) CS_FIXEDSTRING DEFAULT '-', "BcgVatGrp" NVARCHAR(8), "BcgVatPcnt" DECIMAL(21,6) CS_FIXED, "SeqCode" SMALLINT CS_INT, "Serial" INTEGER CS_INT, "SeriesStr" NVARCHAR(3), "SubStr" NVARCHAR(3), "BSRCode" NVARCHAR(25), "LocCode" INTEGER CS_INT, "WTOnhldPst" DECIMAL(21,6) CS_FIXED, "UserSign2" SMALLINT CS_INT, "BuildDesc" NVARCHAR(50), "ResidenNum" CHAR(1) CS_FIXEDSTRING DEFAULT '1', "OperatCode" CHAR(1) CS_FIXEDSTRING, "UndOvDiffF" DECIMAL(21,6) CS_FIXED, "MIEntry" INTEGER CS_INT DEFAULT 0, "FreeText1" NVARCHAR(100), "FreeText2" NVARCHAR(100), "FreeText3" NVARCHAR(100), "ShowDocNo" CHAR(1) CS_FIXEDSTRING DEFAULT 'Y', "TDSInterst" DECIMAL(21,6) CS_FIXED DEFAULT 0, "TDSCharges" DECIMAL(21,6) CS_FIXED DEFAULT 0, "CUP" INTEGER CS_INT, "CIG" INTEGER CS_INT, "MIType" NVARCHAR(20), "SupplCode" NVARCHAR(254), "BPLId" INTEGER CS_INT, "BPLName" NVARCHAR(100), "VATRegNum" NVARCHAR(32), "BPLCentPmt" CHAR(1) CS_FIXEDSTRING DEFAULT 'N', "DraftKey" INTEGER CS_INT, "TDSFee" DECIMAL(21,6) CS_FIXED, "MinHeadCL" INTEGER CS_INT, "SEPADate" LONGDATE CS_LONGDATE, "OwnerCode" INTEGER CS_INT, "AgrNo" INTEGER CS_INT, "CreateTS" INTEGER CS_INT, "UpdateTS" INTEGER CS_INT, "TDSType" CHAR(1) CS_FIXEDSTRING, "DrNo" NVARCHAR(32), "U_B1SYS_PmntMethod" NVARCHAR(50) DEFAULT '01' NOT NULL , "U_B1SYS_Confirm" NVARCHAR(5), "U_Cuenta" NVARCHAR(18), "U_Banco" NVARCHAR(10), "U_RFC" NVARCHAR(13), "U_Cta_Propio" NVARCHAR(18), "U_Banco_Propio" NVARCHAR(10), "U_RFC_Propio" NVARCHAR(13), PRIMARY KEY ("DocEntry")) UNLOAD PRIORITY 5  AUTO MERGE ;
ALTER TABLE "IMCYC"."OPDF" WITH PARAMETERS ('CONCAT_ATTRIBUTE'=('$DocNum$PIndicator$','DocNum','PIndicator'));
CREATE INDEX "OPDF_NUM" ON "IMCYC"."OPDF" ( "DocNum" ASC, "PIndicator" ASC );
CREATE INDEX "OPDF_CARD" ON "IMCYC"."OPDF" ( "CardCode" ASC );
CREATE INDEX "OPDF_HANDWRITEN" ON "IMCYC"."OPDF" ( "Handwrtten" ASC );
CREATE INDEX "OPDF_CANCELED" ON "IMCYC"."OPDF" ( "Canceled" ASC );
CREATE INDEX "OPDF_SERIES" ON "IMCYC"."OPDF" ( "Series" ASC )