public ActionResult BLP010_GenerateReport(string strInvoiceNo) { ObjectResultData res = new ObjectResultData(); IBillingHandler billingHandler = ServiceContainer.GetService <IBillingHandler>() as IBillingHandler; IBillingDocumentHandler billingDocumentHandler = ServiceContainer.GetService <IBillingDocumentHandler>() as IBillingDocumentHandler; try { List <tbt_Invoice> invoiceList = billingHandler.GetTbt_Invoice(strInvoiceNo, null).OrderByDescending(t => t.InvoiceOCC).ToList <tbt_Invoice>(); if (invoiceList != null && invoiceList.Count > 0) { billingDocumentHandler.GenerateBLR010FilePath(invoiceList[0].InvoiceNo, ProcessID.C_PROCESS_ID_MANAGE_INVOICE, invoiceList[0].CreateDate.Value); } //ICommonHandler comHandler = ServiceContainer.GetService<ICommonHandler>() as ICommonHandler; //List<tbt_DocumentList> documentList = comHandler.GetTbt_DocumentList(null, null, null); //if (documentList != null && documentList.Count > 0) //{ // foreach (tbt_DocumentList data in documentList) // { // billingDocumentHandler.GenerateBLR010FilePath(data.DocumentNo, ProcessID.C_PROCESS_ID_MANAGE_INVOICE, data.CreateDate.Value); // } //} } catch (Exception ex) { res.AddErrorMessage(ex); } return(Json(res)); }
public ActionResult BLP030_ManageInvoiceProcessTemp() { ObjectResultData res = new ObjectResultData(); IBillingHandler billingHandler = ServiceContainer.GetService <IBillingHandler>() as IBillingHandler; ICommonHandler comHandler = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; IBillingDocumentHandler billingDocumentHandler = ServiceContainer.GetService <IBillingDocumentHandler>() as IBillingDocumentHandler; try { //using (TransactionScope scope = new TransactionScope()) //{ List <tbt_Invoice> invoiceList = billingHandler.GetTbt_Invoice(null, null); List <tbt_DocumentList> documentList = comHandler.GetTbt_DocumentList(null, null, null); invoiceList = (from t in invoiceList where //t.CreateBy == "BLP030" //&& t.InvoicePaymentStatus != "08" //&& t.CreateDate <= new DateTime(2013, 6, 21) && t.CreateDate > new DateTime(2013, 6, 20) && !documentList.Any(d => (d.DocumentNo == t.InvoiceNo)) select t).ToList <tbt_Invoice>(); foreach (tbt_Invoice data in invoiceList) { billingDocumentHandler.GenerateBLR010FilePath(data.InvoiceNo, ProcessID.C_PROCESS_ID_MANAGE_INVOICE, data.CreateDate.Value); } // Comment by Jirawat Jannet //List<tbt_TaxInvoice> taxInvoiceList = billingHandler.GetTbt_TaxInvoice(null); //taxInvoiceList = (from t in taxInvoiceList // where // //t.CreateBy == "BLP030" // //&& // t.CreateDate <= new DateTime(2013, 6, 21) // && t.CreateDate > new DateTime(2013, 6, 20) // && !documentList.Any(d => (d.DocumentNo == t.TaxInvoiceNo)) // select t).ToList<tbt_TaxInvoice>(); // Comment by Jirawat Jannet //foreach (tbt_TaxInvoice data in taxInvoiceList) //{ // billingDocumentHandler.GenerateBLR020FilePath(data.TaxInvoiceNo, ProcessID.C_PROCESS_ID_MANAGE_INVOICE, data.CreateDate.Value); //} // scope.Complete(); // res.ResultData = "Process Complete."; //} res.ResultData = "Process Complete."; } catch (Exception ex) { res.AddErrorMessage(ex); } return(Json(res)); }