protected void _(Events.RowPersisting <ARInvoice> e, PXRowPersisting InvokeBaseHandler) { InvokeBaseHandler?.Invoke(e.Cache, e.Args); if (e.Operation == PXDBOperation.Insert || e.Operation == PXDBOperation.Update) { ARRegisterExt regisExt = PXCache <ARRegister> .GetExtension <ARRegisterExt>(e.Row); //if (e.Row.CuryDocBal == decimal.Zero && string.IsNullOrEmpty(regisExt.UsrGUINbr)) //{ // regisExt.UsrVATOutCode = string.Empty; //} //else if (string.IsNullOrEmpty(regisExt.UsrGUINbr) && (regisExt.UsrVATOutCode == TWGUIFormatCode.vATOutCode31 || regisExt.UsrVATOutCode == TWGUIFormatCode.vATOutCode32 || regisExt.UsrVATOutCode == TWGUIFormatCode.vATOutCode35)) { TWNGUIPreferences gUIPreferences = SelectFrom <TWNGUIPreferences> .View.Select(Base); regisExt.UsrGUINbr = ARGUINbrAutoNumAttribute.GetNextNumber(e.Cache, e.Row, regisExt.UsrVATOutCode == TWGUIFormatCode.vATOutCode32 ? gUIPreferences.GUI2CopiesNumbering : gUIPreferences.GUI3CopiesNumbering, regisExt.UsrGUIDate); tWNGUIValidation.CheckGUINbrExisted(Base, regisExt.UsrGUINbr, regisExt.UsrVATOutCode); } } }
protected void _(Events.FieldDefaulting <TWNManualGUIExpense, TWNManualGUIExpense.ourTaxNbr> e) { var row = (TWNManualGUIExpense)e.Row; TWNGUIPreferences preferences = SelectFrom <TWNGUIPreferences> .View.Select(Base); e.NewValue = row.VendorID == null ? preferences.OurTaxNbr : e.NewValue; }
protected void buyPlasticBag() { ARTran aRTran = Base.Transactions.Cache.CreateInstance() as ARTran; TWNGUIPreferences GUIPreferences = SelectFrom <TWNGUIPreferences> .View.Select(Base); if (GUIPreferences.PlasticBag == null) { throw new MissingMemberException(TWMessages.NoPlasticBag); } aRTran.InventoryID = GUIPreferences.PlasticBag; aRTran.Qty = 1; Base.Transactions.Cache.Insert(aRTran); }
public static void Upload(List <TWNGUITrans> tWNGUITrans) { try { // Avoid to create empty content file in automation schedule. if (tWNGUITrans.Count == 0) { return; } TWNExpGUIInv2BankPro graph = CreateInstance <TWNExpGUIInv2BankPro>(); string lines = "", fileName = ""; TWNGUIPreferences preferences = PXSelect <TWNGUIPreferences> .Select(graph); fileName = preferences.OurTaxNbr + "-InvoiceMD--Paper-" + DateTime.Today.ToString("yyyyMMdd") + "-" + DateTime.Now.ToString("hhmmss") + ".txt"; foreach (TWNGUITrans gUITrans in tWNGUITrans) { // File Type lines += "M" + verticalBar; // Bill type lines += GetBillType(gUITrans) + verticalBar; // Invoice No lines += gUITrans.GUINbr + verticalBar; // Invoice Date Time lines += gUITrans.GUIDate.Value.ToString("yyyy/MM/dd HH:mm:ss") + verticalBar; // Allowance Date // Cancel Date lines += verticalBar + GetCancelDate(gUITrans) + verticalBar; // Bill Attribute // Seller Ban lines += verticalBar + gUITrans.OurTaxNbr + verticalBar; // Seller Code lines += verticalBar; // Buyer Ban lines += gUITrans.TaxNbr + verticalBar; // Buyer Code lines += verticalBar; // Buyer CName lines += gUITrans.GUITitle + verticalBar; // Sales Amount lines += GetSalesAmt(gUITrans) + verticalBar; // Tax Type lines += GetTaxType(gUITrans.VATType) + verticalBar; // Tax Rate lines += GetTaxRate(gUITrans.VATType) + verticalBar; // Tax Amount lines += GetTaxAmt(gUITrans) + verticalBar; // Total Amount lines += (gUITrans.NetAmount + gUITrans.TaxAmount).Value + verticalBar; // Health Tax lines += "0" + verticalBar; // Buyer Remark lines += verticalBar; // Main Remark lines += verticalBar; // Order No = Relate Number1 lines += gUITrans.OrderNbr + verticalBar; // Relate Number2 // Relate Number3 // Relate Number4 // Relate Number5 // Group Mark // Customs Clearance Mark lines += new string(char.Parse(verticalBar), 5) + GetCustomClearance(gUITrans) + verticalBar; // Bonded Area Enum lines += verticalBar; // Random Number lines += (gUITrans.BatchNbr != null) ? gUITrans.BatchNbr.Substring(gUITrans.BatchNbr.Length - 4, 4) : null; lines += verticalBar; // Carrier Type lines += ARReleaseProcess_Extension.GetCarrierType(gUITrans.CarrierID) + verticalBar; // Carrier ID lines += ARReleaseProcess_Extension.GetCarrierID(gUITrans.TaxNbr, gUITrans.CarrierID) + verticalBar; // NPOBAN lines += ARReleaseProcess_Extension.GetNPOBAN(gUITrans.TaxNbr, gUITrans.NPONbr) + verticalBar; // Request Paper lines += gUITrans.B2CPrinted.Equals(true) ? "Y" : "N" + verticalBar; // Void Reason // Project Number Void Approved lines += new string(char.Parse(verticalBar), 2) + "\r\n"; // The following method is only for voided invoice. if (gUITrans.GUIStatus == TWNGUIStatus.Voided) { CreateVoidedDetailLine(verticalBar, gUITrans.OrderNbr, ref lines); } else { foreach (PXResult <ARTran> result in graph.RetrieveARTran(gUITrans.OrderNbr)) { ARTran aRTran = result; string taxCalcMode = SelectFrom <ARRegister> .Where <ARRegister.docType.IsEqual <@P.AsString> .And <ARRegister.refNbr.IsEqual <@P.AsString> > > .View.ReadOnly.Select(graph, aRTran.TranType, aRTran.RefNbr).TopFirst.TaxCalcMode; // File Type lines += "D" + verticalBar; // Description lines += aRTran.TranDesc + verticalBar; // Quantity lines += (aRTran.Qty ?? 1) + verticalBar; // Unit Price // Amount #region Convert design spec logic to code. //if (aRTran.CuryDiscAmt == 0m) //{ // if (taxCalcMode != PX.Objects.TX.TaxCalculationMode.Gross) // { // if (!string.IsNullOrEmpty(gUITrans.TaxNbr)) // { // lines += aRTran.UnitPrice + verticalBar; // } // else // { // lines += aRTran.UnitPrice * fixedRate + verticalBar; // } // } // else // { // if (!string.IsNullOrEmpty(gUITrans.TaxNbr)) // { // lines += aRTran.UnitPrice / fixedRate + verticalBar; // } // else // { // lines += aRTran.UnitPrice + verticalBar; // } // } //} //else //{ // if (taxCalcMode != PX.Objects.TX.TaxCalculationMode.Gross) // { // if (!string.IsNullOrEmpty(gUITrans.TaxNbr)) // { // lines += aRTran.TranAmt / aRTran.Qty + verticalBar; // } // else // { // lines += aRTran.TranAmt / aRTran.Qty * fixedRate + verticalBar; // } // } // else // { // if (!string.IsNullOrEmpty(gUITrans.TaxNbr)) // { // lines += aRTran.TranAmt / aRTran.Qty / fixedRate + verticalBar; // } // else // { // lines += aRTran.TranAmt / aRTran.Qty + verticalBar; // } // } //} #endregion decimal?unitPrice = (aRTran.CuryDiscAmt == 0m) ? aRTran.UnitPrice : (aRTran.TranAmt / aRTran.Qty); decimal?tranAmt = aRTran.TranAmt; if (string.IsNullOrEmpty(gUITrans.TaxNbr) && taxCalcMode != PX.Objects.TX.TaxCalculationMode.Gross) { unitPrice *= fixedRate; tranAmt *= fixedRate; } else if (!string.IsNullOrEmpty(gUITrans.TaxNbr) && taxCalcMode == PX.Objects.TX.TaxCalculationMode.Gross) { unitPrice /= fixedRate; tranAmt /= fixedRate; } lines += string.Format("{0:0.####}", unitPrice) + verticalBar; lines += string.Format("{0:0.####}", tranAmt) + verticalBar; // Unit lines += verticalBar; // Package lines += "0" + verticalBar; // Gift Number 1 (Box) lines += "0" + verticalBar; // Gift Number 2 (Piece) lines += "0" + verticalBar; // Order No lines += gUITrans.OrderNbr; // Buyer Barcode // Buyer Prod No // Seller Prod No // Seller Account No // Seller Shipping No // Remark // Relate Number1 // Relate Number2 (Invoice No) // Relate Number3 (Invoice Date) // Relate Number4 // Relate Number5 lines += new string(char.Parse(verticalBar), 11) + "\r\n"; } } } // Total Records lines += tWNGUITrans.Count; graph.UpdateGUITran(tWNGUITrans); graph.UploadFile2FTP(fileName, lines); } catch (Exception ex) { PXProcessing <TWNGUITrans> .SetError(ex); throw; } }
public static void Upload(List <TWNGUITrans> tWNGUITrans) { try { // Avoid to create empty content file in automation schedule. if (tWNGUITrans.Count == 0) { return; } TWNExpOnlineStrGUIInv graph = CreateInstance <TWNExpOnlineStrGUIInv>(); TWNExpGUIInv2BankPro invGraph = CreateInstance <TWNExpGUIInv2BankPro>(); string lines = "", fileName = ""; TWNGUIPreferences preferences = PXSelect <TWNGUIPreferences> .Select(graph); fileName = preferences.OurTaxNbr + "-O-" + DateTime.Today.ToString("yyyyMMdd") + "-" + DateTime.Now.ToString("hhmmss") + ".txt"; foreach (TWNGUITrans gUITrans in tWNGUITrans) { // 主檔代號 lines += "M" + verticalBar; // 訂單編號 lines += gUITrans.OrderNbr + verticalBar; // 訂單狀態 lines += ((gUITrans.VATType != TWGUIFormatCode.vATOutCode33) ? "0" : "3") + verticalBar; // 訂單日期 lines += gUITrans.TransDate.Value.ToString("yyyy/MM/dd") + verticalBar; // 預計出貨日 lines += gUITrans.GUIDate.Value.ToString("yyyy/MM/dd") + verticalBar; // 稅率別 -> 1:應稅 2:零稅率 3:免稅 4:特殊稅率(需帶36 & 37欄位) lines += (gUITrans.GUIFormatcode.IsIn(TWGUIFormatCode.vATOutCode36, TWGUIFormatCode.vATOutCode37)) ? "4" : TWNExpGUIInv2BankPro.GetTaxType(gUITrans.VATType) + verticalBar; // 訂單金額(未稅) lines += gUITrans.NetAmount + verticalBar; // 訂單稅額 lines += gUITrans.TaxAmount + verticalBar; // 訂單金額(含稅) lines += (gUITrans.NetAmount + gUITrans.TaxAmount) + verticalBar; // 賣方統一編號 lines += gUITrans.OurTaxNbr + verticalBar; // 賣方廠編 lines += verticalBar; // 買方統一編號 lines += gUITrans.TaxNbr + verticalBar; // 買受人公司名稱 lines += verticalBar; // 會員編號 lines += gUITrans.CustVend + verticalBar; // 會員姓名 // 會員郵遞區號 // 會員地址 // 會員電話 lines += new string(char.Parse(verticalBar), 4); // 會員行動電話 PX.Objects.AR.Customer customer = PXSelectReadonly <PX.Objects.AR.Customer, Where <PX.Objects.AR.Customer.acctCD, Equal <Required <PX.Objects.AR.Customer.acctCD> > > > .Select(graph, gUITrans.CustVend); PX.Objects.CR.CRContact contact = PX.Objects.CR.CRContact.PK.Find(graph, PX.Objects.AR.Customer.PK.Find(graph, customer.BAccountID).DefContactID); lines += contact?.Phone1 + verticalBar; // 會員電子郵件 lines += contact?.Email + verticalBar; // 紅利點數折扣金額 lines += verticalBar; // 索取紙本發票 lines += "N" + verticalBar; // 發票捐贈註記 lines += gUITrans.NPONbr + verticalBar; // 訂單註記 // 付款方式 // 相關號碼1(出貨單號) lines += new string(char.Parse(verticalBar), 3); // 相關號碼2 lines += gUITrans.BatchNbr + verticalBar; // 相關號碼3 // 主檔備註 // 商品名稱 lines += new string(char.Parse(verticalBar), 3); // 載具類別號碼 lines += gUITrans.CarrierType + verticalBar; // 載具顯碼id1(明碼) lines += gUITrans.CarrierID + verticalBar; // 載具隱碼id2(內碼) lines += verticalBar; // 發票號碼 lines += gUITrans.GUINbr + verticalBar; // 隨機碼 lines += gUITrans.OrderNbr.Substring(gUITrans.OrderNbr.Length - 4, 4) + verticalBar; // 稅率代碼 // 稅率 lines += "0" + verticalBar + "\r\n"; int num = 1; foreach (PXResult <PX.Objects.AR.ARTran> result in invGraph.RetrieveARTran(gUITrans.OrderNbr)) { PX.Objects.AR.ARTran aRTran = result; // 明細代號 lines += "D" + verticalBar; // 序號 lines += num++ + verticalBar; // 訂單編號 lines += aRTran.RefNbr + verticalBar; // 商品編號 // 商品條碼 lines += new string(char.Parse(verticalBar), 2); // 商品名稱 lines += aRTran.TranDesc + verticalBar; // 商品規格 // 單位 // 單價 lines += new string(char.Parse(verticalBar), 3); // 數量 lines += (aRTran.Qty == 0m ? 1 : aRTran.Qty) + verticalBar; // 未稅金額 lines += verticalBar; // 含稅金額 PX.Objects.AR.ARInvoice invoice = PX.Objects.AR.ARInvoice.PK.Find(graph, aRTran.TranType, aRTran.RefNbr); lines += (invoice.TaxCalcMode != PX.Objects.TX.TaxCalculationMode.Gross ? aRTran.CuryTranAmt * (decimal)1.05 : aRTran.CuryTranAmt) + verticalBar; // 健康捐 lines += "0" + verticalBar; // 稅率別 lines += TWNExpGUIInv2BankPro.GetTaxType(gUITrans.VATType) + verticalBar; // 紅利點數折扣金額 // 明細備註 lines += new string(char.Parse(verticalBar), 1) + "\r\n"; } // The following method is only for voided invoice. if (gUITrans.GUIStatus == TWNGUIStatus.Voided) { TWNExpGUIInv2BankPro.CreateVoidedDetailLine(verticalBar, gUITrans.OrderNbr, ref lines); } } // Total Records lines += tWNGUITrans.Count; invGraph.UpdateGUITran(tWNGUITrans); invGraph.UploadFile2FTP(fileName, lines); } catch (Exception ex) { PXProcessing <TWNGUITrans> .SetError(ex); throw; } }
public static void Upload(List <TWNGUITrans> tWNGUITrans) { try { // Avoid to create empty content file in automation schedule. if (tWNGUITrans.Count == 0) { return; } TWNExpGUIInv2BankPro graph = CreateInstance <TWNExpGUIInv2BankPro>(); string lines = "", fileName = ""; TWNGUIPreferences preferences = PXSelect <TWNGUIPreferences> .Select(graph); fileName = preferences.OurTaxNbr + "-AllowanceMD--Paper-" + DateTime.Today.ToString("yyyyMMdd") + "-" + DateTime.Now.ToString("hhmmss") + ".txt"; foreach (TWNGUITrans gUITrans in tWNGUITrans) { // File Type lines += "M" + verticalBar; // Bill type lines += TWNExpGUIInv2BankPro.GetBillType(gUITrans) + verticalBar; // Invoice No lines += verticalBar; // Invoice Date Time lines += verticalBar; // Allowance Date lines += gUITrans.GUIDate.Value.ToString("yyyyMMdd") + verticalBar; // Cancel Date lines += TWNExpGUIInv2BankPro.GetCancelDate(gUITrans) + verticalBar; // Bill Attribute lines += verticalBar; // Seller Ban lines += gUITrans.OurTaxNbr + verticalBar; // Seller Code lines += verticalBar; // Buyer Ban lines += gUITrans.TaxNbr + verticalBar; // Buyer Code lines += verticalBar; // Buyer CName lines += gUITrans.GUITitle + verticalBar; // Sales Amount lines += TWNExpGUIInv2BankPro.GetSalesAmt(gUITrans) + verticalBar; // Tax Type lines += TWNExpGUIInv2BankPro.GetTaxType(gUITrans.VATType) + verticalBar; // Tax Rate lines += TWNExpGUIInv2BankPro.GetTaxRate(gUITrans.VATType) + verticalBar; // Tax Amount lines += TWNExpGUIInv2BankPro.GetTaxAmt(gUITrans) + verticalBar; // Total Amount lines += (gUITrans.NetAmount + gUITrans.TaxAmount).Value + verticalBar; // Health Tax lines += "0" + verticalBar; // Buyer Remark lines += verticalBar; // Main Remark lines += verticalBar; // Order No = Relate Number1 lines += (gUITrans.OrderNbr.Length > 16) ? gUITrans.OrderNbr.Substring(0, 16) : gUITrans.OrderNbr + verticalBar; // Relate Number2 // Relate Number3 // Relate Number4 // Relate Number5 // Group Mark // Customs Clearance Mark lines += new string(char.Parse(verticalBar), 5) + TWNExpGUIInv2BankPro.GetCustomClearance(gUITrans) + verticalBar; // Bonded Area Enum lines += verticalBar; // Random Number lines += (gUITrans.BatchNbr != null) ? gUITrans.BatchNbr.Substring(0, 4) : null; // Carrier Type // Carrier ID // NPOBAN // Request Paper // Void Reason // Project Number Void Approved lines += new string(char.Parse(verticalBar), 6) + "\r\n"; foreach (PXResult <ARTran> result in graph.RetrieveARTran(gUITrans.OrderNbr)) { ARTran aRTran = result; // File Type lines += "D" + verticalBar; // Description lines += aRTran.TranDesc + verticalBar; // Quantity lines += aRTran.Qty + verticalBar; // Unit Price // Amount if (gUITrans.TaxNbr != null) { lines += aRTran.UnitPrice + verticalBar; lines += aRTran.TranAmt + verticalBar; } else { lines += (aRTran.UnitPrice * TWNExpGUIInv2BankPro.fixedRate) + verticalBar; lines += (aRTran.TranAmt * TWNExpGUIInv2BankPro.fixedRate) + verticalBar; } // Unit lines += verticalBar; // Package lines += "0" + verticalBar; // Gift Number 1 (Box) lines += "0" + verticalBar; // Gift Number 2 (Piece) lines += "0" + verticalBar; // Order No lines += (gUITrans.OrderNbr.Length > 16) ? gUITrans.OrderNbr.Substring(0, 16) : gUITrans.OrderNbr + verticalBar; // Buyer Barcode // Buyer Prod No // Seller Prod No // Seller Account No // Seller Shipping No // Remark // Relate Number1 // Relate Number2 (Invoice No) lines += new string(char.Parse(verticalBar), 7) + gUITrans.GUINbr + verticalBar; // Relate Number3 (Invoice Date) // Relate Number4 // Relate Number5 lines += gUITrans.GUIDate.Value.ToString("yyyy/MM/dd HH:mm:ss"); lines += new string(char.Parse(verticalBar), 2) + "\r\n"; } // The following method is only for voided invoice. if (gUITrans.GUIStatus == TWNGUIStatus.Voided) { TWNExpGUIInv2BankPro.CreateVoidedDetailLine(verticalBar, gUITrans.OrderNbr, ref lines); } } // Total Records lines += tWNGUITrans.Count; graph.UpdateGUITran(tWNGUITrans); graph.UploadFile2FTP(fileName, lines); } catch (Exception ex) { PXProcessing <TWNGUITrans> .SetError(ex); throw; } }
public void Export(List <TWNGUITrans> tWNGUITrans) { try { TWNGenGUIMediaFile genGUIMediaFile = PXGraph.CreateInstance <TWNGenGUIMediaFile>(); TWNGUIPreferences gUIPreferences = gUIPreferSetup.Current; int count = 1; string lines = "", fileName = "", ticketType = "X7"; using (MemoryStream ms = new MemoryStream()) { using (StreamWriter sw = new StreamWriter(ms, Encoding.ASCII)) { fileName = gUIPreferences.OurTaxNbr + ".t02"; foreach (TWNGUITrans gUITrans in tWNGUITrans) { // Tax ID lines = gUIPreferences.OurTaxNbr; // Country No lines += gUIPreferences.ZeroTaxTaxCntry; // Tax Registration ID lines += gUIPreferences.TaxRegistrationID; // Tax Filling Date lines += genGUIMediaFile.GetGUILegal(FilterGUITran.Current.ToDate.Value); // GUI Date lines += genGUIMediaFile.GetGUILegal(gUITrans.GUIDate.Value); // GUI Number lines += genGUIMediaFile.GetGUINbr(gUITrans); // Customer Tax ID lines += gUITrans.TaxNbr ?? new string(genGUIMediaFile.space, 8); // Export Method lines += gUITrans.ExportMethods; // Custom Method lines += gUITrans.CustomType; // Ticket Type // Ticket Number if (gUITrans.ExportTicketType == ticketType) { lines += new String(genGUIMediaFile.space, 2); lines += new String(genGUIMediaFile.space, 14); } else { lines += gUITrans.ExportTicketType; lines += gUITrans.ExportTicketNbr; } // Amount lines += genGUIMediaFile.GetNetAmt(gUITrans); // Custom Clearing Date lines += GetTWNDate(gUITrans.ClearingDate.Value); // Only the last line does not need to be broken. if (count < tWNGUITrans.Count) { sw.WriteLine(lines); count++; } else { sw.Write(lines); } } //Write to file //FixedLengthFile flatFile = new FixedLengthFile(); //flatFile.WriteToFile(recordList, sw); //sw.Flush(); sw.Close(); PX.SM.FileInfo info = new PX.SM.FileInfo(fileName, null, ms.ToArray()); throw new PXRedirectToFileException(info, true); } } } catch (Exception ex) { PXProcessing <TWNGUITrans> .SetError(ex); throw; } }
public void Export(List <TWNGUITrans> tWNGUITrans) { try { TWNGUIPreferences gUIPreferences = gUIPreferSetup.Current; int count = 1; string lines = "", fileName = ""; using (MemoryStream stream = new MemoryStream()) { using (StreamWriter sw = new StreamWriter(stream, Encoding.ASCII)) { fileName = gUIPreferences.OurTaxNbr + ".txt"; foreach (TWNGUITrans gUITrans in tWNGUITrans) { ourTaxNbr = gUITrans.OurTaxNbr; // Reporting Code lines = gUITrans.GUIFormatcode; // Tax Registration lines += gUIPreferences.TaxRegistrationID; // Sequence Number lines += AutoNumberAttribute.GetNextNumber(GUITransList.Cache, gUITrans, gUIPreferences.MediaFileNumbering, Accessinfo.BusinessDate); // GUI LegalYM lines += GetGUILegal(gUITrans.GUIDate.Value); // Tax ID (Buyer) lines += GetBuyerTaxID(gUITrans); // Tax ID (Seller) lines += GetSellerTaxID(gUITrans); // GUI Number lines += GetGUINbr(gUITrans); // Net Amount lines += GetNetAmt(gUITrans); // Tax Group lines += GetTaxGroup(gUITrans); // Tax Amount lines += GetTaxAmt(gUITrans); // Deduction Code lines += (gUITrans.DeductionCode != null || gUITrans.GUIFormatcode.StartsWith("2")) ? gUITrans.DeductionCode : new string(space, 1); // Blank lines += new string(space, 5); // Special Tax Rate lines += new string(space, 1); // Summary Remark lines += GetSummaryRemark(gUITrans); // Export Method lines += GetExportMethod(gUITrans); // Only the last line does not need to be broken. if (count < tWNGUITrans.Count) { sw.WriteLine(lines); count++; } else { sw.Write(lines); } } count = 1; PXSelectBase <NumberingSequence> query = new PXSelect <NumberingSequence, Where <NumberingSequence.numberingID, Like <GUI2x>, Or <NumberingSequence.numberingID, Like <GUI3x>, And <NumberingSequence.startDate, GreaterEqual <Current <GUITransFilter.fromDate> >, And <NumberingSequence.startDate, LessEqual <Current <GUITransFilter.toDate> > > > > > >(this); foreach (NumberingSequence numSeq in query.Select()) { int endNbr = Int32.Parse(numSeq.EndNbr.Substring(2)); int lastNbr = Int32.Parse(numSeq.LastNbr.Substring(2)); if (numSeq.StartNbr.Equals(numSeq.LastNbr) || lastNbr <= endNbr) { lines = "\r\n"; // Reporting Code lines += numSeq.NumberingID.Substring(numSeq.NumberingID.IndexOf('I') + 1, 2); // Tax Registration lines += gUIPreferences.TaxRegistrationID; // Sequence Number lines += AutoNumberAttribute.GetNextNumber(GUITransList.Cache, numSeq, gUIPreferences.MediaFileNumbering, Accessinfo.BusinessDate); // GUI LegalYM lines += GetGUILegal(Filter.Current.ToDate.Value); // Tax ID (Buyer) lines += numSeq.EndNbr.Substring(2); // Tax ID (Seller) lines += ourTaxNbr; // GUI Number lines += string.Format("{0}{1}", numSeq.LastNbr.Substring(0, 2), lastNbr + 1); // Net Amount lines += new string(zero, 12); // Tax Group lines += "D"; // Tax Amount lines += new string(zero, 10); // Deduction Code lines += new string(space, 1); // Blank lines += new string(space, 5); // Special Tax Rate lines += new string(space, 1); // Summary Remark lines += "A"; // Export Method lines += new string(space, 1); sw.Write(lines); } } sw.Close(); // Redirect browser to file created in memory on server throw new PXRedirectToFileException(new PX.SM.FileInfo(Guid.NewGuid(), fileName, null, stream.ToArray(), string.Empty), true); } } } catch (PXException ex) { PXProcessing <TWNGUITrans> .SetError(ex); throw; } }