protected void BindData(Bill bill) { double _amount = 0; double _taxAmount = 0; double _taxPercent = 0; var taxPercentageList = BillBOBase.GetDistinctTaxPercentageList(bill.BillId); if (taxPercentageList == null || taxPercentageList.Count() == 0) { _amount = bill.SumOfItemPrice; _taxAmount = 0; _taxPercent = 0; } else { _taxPercent = taxPercentageList.First().Percentage; _taxAmount = bill.SumOfTax; _amount = bill.SumOfItemPrice - bill.SumOfPromotion; } lblTaxPercent.Text = _taxPercent > 0 ? _taxPercent.ToString() : "-"; lblTaxAmount.Text = _taxAmount > 0 ? _taxAmount.ToString("n0") : "-"; lblAmount.Text = _amount > 0 ? _amount.ToString("n0") : "-"; XPQuery <BillTaxClaim> billTaxClaim = new XPQuery <BillTaxClaim>(session); XPQuery <SaleInvoiceArtiface> saleInvoiceArtiface = new XPQuery <SaleInvoiceArtiface>(session); var list = from btc in billTaxClaim.AsEnumerable() join sia in saleInvoiceArtiface on btc.BillId.BillId equals sia.BillId.BillId where btc.BillId.BillId == bill.BillId select new C011GTGT() { Amount = btc.Amount, ClaimItem = btc.ClaimItem, Comment = btc.Comment, CreateDate = btc.CreateDate, TaxInNumber = btc.TaxInNumber, TaxInPercentage = btc.TaxInPercentage, TotalAmount = btc.TotalAmount, BillCode = sia.IssuedArtifaceCode, SeriesNumber = sia.SeriesNumber, ObjectName = btc.BillId.SourceOrganizationId.Name, ObjectTax = btc.BillId.SourceOrganizationId.TaxNumber, LegalInvoiceArtifactTypeCode = sia.LegalInvoiceArtifactTypeId.Code, LegalInvoiceArtifactTypeName = sia.LegalInvoiceArtifactTypeId.Name }; try { grdBillTaxClaim.DataSource = list.ToList(); grdBillTaxClaim.DataBind(); grdBillTaxClaim.ExpandAll(); } catch { } }
protected void Page_Load(object sender, EventArgs e) { artifactCodeRuleBO = new ArtifactCodeRuleBO(); SetCriteriaForOrganization(); dsVouchersAmount.CriteriaParameters["VouchesId"].DefaultValue = PrivateSession.Instance.ReceiptVoucherId.ToString(); /*2013-11-24 Khoa.Truong MOD START*/ //grdVouchersAmount.DataBind(); if (!IsPostBack) { grdVouchersAmount.DataBind(); } /*2013-11-24 Khoa.Truong MOD END*/ this.InvisibleCommandColumnGridviewIfApprovedCosting(grdVouchersAmount, "CommonOperations"); if (Page.IsPostBack) { if (hReceiptViewer.Contains("print")) { XPQuery <ReceiptVouches> receiptVouches = new XPQuery <ReceiptVouches>(session); XPQuery <VouchesAmount> vouchesAmount = new XPQuery <VouchesAmount>(session); var list = from r in receiptVouches.AsEnumerable() join va in vouchesAmount.AsEnumerable() on r.VouchesId equals va.VouchesId.VouchesId where r.VouchesId == PrivateSession.Instance.ReceiptVoucherId select new C01TT { Code = r.Code, IssuedDate = r.IssuedDate, Description = r.Description, CustomerName = r.SourceOrganizationId.Name, Address = r.Address, ReceiverName = r.Payer, Debit = va.Debit, ExchangeRate = va.ExchangeRate, DebitExchange = va.Debit * va.ExchangeRate, //DebitByString = Utility.Accounting.NumberToStringFullCurrency(float.Parse(va.Debit.ToString()), va.ForeignCurrencyId.Name), //Currency = va.ForeignCurrencyId.Code DebitByString = Utility.Accounting.NumberToStringFullCurrency(float.Parse(va.Debit.ToString()), va.CurrencyId.Name), Currency = va.CurrencyId.Code }; List <C01TT> lst = new List <C01TT>(); try { if (list.Count <C01TT>() > 0) { lst = list.Cast <C01TT>().ToList(); } } catch (Exception) { lst = null; } XPQuery <ReceiptVouchesTransaction> receiptVouchesTransaction = new XPQuery <ReceiptVouchesTransaction>(session); XPQuery <GeneralJournal> generalJournal = new XPQuery <GeneralJournal>(session); var listg = from p in receiptVouchesTransaction.AsEnumerable() join g in generalJournal.AsEnumerable() on p.TransactionId equals g.TransactionId.TransactionId where p.ReceiptVouchesId.VouchesId == PrivateSession.Instance.ReceiptVoucherId orderby g.Credit, g.Debit select new { Dc = g.Debit > g.Credit ? "Nợ :" : "Có :", Account = g.AccountId.Code, Amount = Math.Max(g.Debit, g.Credit) }; grdBooking.DataSource = listg.ToList(); grdBooking.DataBind(); _01_TT report = new _01_TT(); report.DataSource = lst; report.DataMember = ""; report.pccData.PrintableComponent = new PrintableComponentLinkBase() { Component = gvDataExporter }; rptReceiptViewer.Report = report; hReceiptViewer.Remove("print"); cpReceiptViewer.JSProperties.Add("cpShowForm", "report"); } } }
protected void Page_Load(object sender, EventArgs e) { if (ReportHiddenField.Contains("typeReport")) { XPQuery <BillTaxClaim> billTaxClaim = new XPQuery <BillTaxClaim>(session); XPQuery <Bill> bill = new XPQuery <Bill>(session); XPQuery <SaleInvoiceArtiface> saleInvoiceArtiface = new XPQuery <SaleInvoiceArtiface>(session); char vatType = (ReportHiddenField.Get("typeReport").ToString() == "01-1/GTGT" ? Constant.VAT_OUT : Constant.VAT_IN); var list = from btc in billTaxClaim.AsEnumerable() join sia in saleInvoiceArtiface on btc.BillId.BillId equals sia.BillId.BillId where sia.LegalInvoiceArtifactTypeId.Category == vatType select new C011GTGT() { Amount = btc.Amount, ClaimItem = btc.ClaimItem, Comment = btc.Comment, CreateDate = btc.CreateDate, TaxInNumber = btc.TaxInNumber, TaxInPercentage = btc.TaxInPercentage, TotalAmount = btc.TotalAmount, BillCode = sia.IssuedArtifaceCode, SeriesNumber = sia.SeriesNumber, ObjectName = btc.BillId.SourceOrganizationId.Name, ObjectTax = btc.BillId.SourceOrganizationId.TaxNumber, LegalInvoiceArtifactTypeCode = sia.LegalInvoiceArtifactTypeId.Code, LegalInvoiceArtifactTypeName = sia.LegalInvoiceArtifactTypeId.Name }; List <C011GTGT> data = new List <C011GTGT>(); try { CriteriaOperator _filter = new GroupOperator(GroupOperatorType.And, new BinaryOperator("Category", vatType, BinaryOperatorType.Equal), new BinaryOperator("RowStatus", 1, BinaryOperatorType.GreaterOrEqual)); XPCollection <NAS.DAL.Accounting.LegalInvoice.LegalInvoiceArtifactType> _legalInvoiceArtifactType = new XPCollection <NAS.DAL.Accounting.LegalInvoice.LegalInvoiceArtifactType>(session); _legalInvoiceArtifactType.Criteria = _filter; var _result = list; foreach (NAS.DAL.Accounting.LegalInvoice.LegalInvoiceArtifactType liat in _legalInvoiceArtifactType) { if (!list.ToList().Any(l => l.LegalInvoiceArtifactTypeCode == liat.Code)) { C011GTGT _c011GTGT = new C011GTGT() { Amount = 0, ClaimItem = "", Comment = "", CreateDate = DateTime.Now, TaxInNumber = 0, TaxInPercentage = 0, TotalAmount = 0, BillCode = "", SeriesNumber = "", ObjectName = "", ObjectTax = "", LegalInvoiceArtifactTypeCode = liat.Code, LegalInvoiceArtifactTypeName = liat.Name }; _result = _result.Concat(new List <C011GTGT> { _c011GTGT }); } } data = _result.ToList(); } catch { } if (vatType == Constant.VAT_OUT) { _01_1_GTGT report = new _01_1_GTGT(); report.DataSource = data; report.DataMember = ""; reportViewer.Report = report; } else { _01_2_GTGT report = new _01_2_GTGT(); report.DataSource = data; report.DataMember = ""; reportViewer.Report = report; } formInvoiceVatReport.JSProperties.Add("cpShowReport", "report"); } }
protected void Page_Load(object sender, EventArgs e) { if (hOutputCommId.Contains("id") && hOutputCommPrint.Contains("print")) { List <C02VT> lst = new List <C02VT>(); if (hOutputCommPrint.Get("print").ToString().Equals("inventory")) { XPQuery <SalesInvoiceInventoryTransaction> salesInvoiceInventoryTransaction = new XPQuery <SalesInvoiceInventoryTransaction>(session); XPQuery <InventoryTransaction> inventoryTransaction = new XPQuery <InventoryTransaction>(session); XPQuery <InventoryLedger> inventoryLedger = new XPQuery <InventoryLedger>(session); XPQuery <BillItem> billItem = new XPQuery <BillItem>(session); Guid billId = Guid.Parse(hOutputCommId.Get("id").ToString()); //var list = from sales in salesInvoiceInventoryTransaction.AsEnumerable() // join inTrans in inventoryTransaction on sales.InventoryTransactionId equals inTrans.InventoryTransactionId // join inLed in inventoryLedger on inTrans.InventoryTransactionId equals inLed.InventoryTransactionId.InventoryTransactionId // join bi in billItem on new { BillId = (Guid)sales.SalesInvoiceId.BillId, ItemUnitId= (Guid)inLed.ItemUnitId.ItemUnitId } // equals new { BillId = (Guid)bi.BillId.BillId, ItemUnitId = (Guid)bi.ItemUnitId.ItemUnitId } // where sales.InventoryTransactionId == billId // select new C02VT // { // code = inTrans.Code, // createDate = inTrans.CreateDate, // itemCode = inLed.ItemUnitId.ItemId.Code, // itemName = inLed.ItemUnitId.ItemId.Name, // itemUnit = inLed.ItemUnitId.UnitId.Name, // quantity = inLed.Credit, // SaleInvoiceCode = sales.SalesInvoiceId.Code, // InventoryName = inLed.InventoryId.Name, // InventoryAddress = inLed.InventoryId.Address // }; //var list = //from bi in billItem.AsEnumerable() // from sales in salesInvoiceInventoryTransaction.AsEnumerable() // join bi in billItem.AsEnumerable() on new { sales.SalesInvoiceId.BillId } equals new { bi.BillId.BillId } // //from inLed in inventoryLedger.AsEnumerable() // where sales.InventoryTransactionId == billId // //&& bi.ItemUnitId.ItemUnitId == inLed.ItemUnitId.ItemUnitId // //&& sales.InventoryTransactionId == inLed.InventoryTransactionId.InventoryTransactionId // select new C02VT // { // //code = inLed.InventoryTransactionId.Code, // //createDate = inLed.InventoryTransactionId.CreateDate, // //itemCode = inLed.ItemUnitId.ItemId.Code, // //itemName = inLed.ItemUnitId.ItemId.Name, // //itemUnit = inLed.ItemUnitId.UnitId.Name, // //quantity = inLed.Credit, // SaleInvoiceCode = ""//sales.SalesInvoiceId.Code, // //InventoryName = inLed.InventoryId.Name, // //InventoryAddress = inLed.InventoryId.Address // }; var list = from bi in billItem.AsEnumerable() where bi.BillId != null join sales in salesInvoiceInventoryTransaction.AsEnumerable() on bi.BillId.BillId equals sales.SalesInvoiceId.BillId join inLed in inventoryLedger.AsEnumerable() on sales.InventoryTransactionId equals inLed.InventoryTransactionId.InventoryTransactionId where sales.InventoryTransactionId == billId && bi.ItemUnitId.ItemUnitId == inLed.ItemUnitId.ItemUnitId select new C02VT { code = inLed.InventoryTransactionId.Code, createDate = inLed.InventoryTransactionId.CreateDate, itemCode = inLed.ItemUnitId.ItemId.Code, itemName = inLed.ItemUnitId.ItemId.Name, itemUnit = inLed.ItemUnitId.UnitId.Name, quantity = bi.Quantity, SaleInvoiceCode = sales.SalesInvoiceId.Code, InventoryName = inLed.InventoryId.Name, InventoryAddress = inLed.InventoryId.Address }; try { lst = list.ToList(); } catch { } } else { XPQuery <SalesInvoiceInventoryTransaction> salesInvoiceInventoryTransaction = new XPQuery <SalesInvoiceInventoryTransaction>(session); XPQuery <InventoryTransaction> inventoryTransaction = new XPQuery <InventoryTransaction>(session); XPQuery <COGS> cogs = new XPQuery <COGS>(session); XPQuery <COGS> sum = new XPQuery <COGS>(session); var ntos = from s in sum.AsEnumerable() where s.InventoryTransactionId.InventoryTransactionId == Guid.Parse(hOutputCommId.Get("id").ToString()) group s by s.InventoryTransactionId.InventoryTransactionId into g select new { total = g.Sum(x => x.COGSPrice * x.Credit) }; var list = from sales in salesInvoiceInventoryTransaction.AsEnumerable() join inTrans in inventoryTransaction.AsEnumerable() on sales.InventoryTransactionId equals inTrans.InventoryTransactionId join co in cogs.AsEnumerable() on inTrans.InventoryTransactionId equals co.InventoryTransactionId.InventoryTransactionId where sales.InventoryTransactionId == Guid.Parse(hOutputCommId.Get("id").ToString()) select new C02VT { code = inTrans.Code, createDate = inTrans.CreateDate, itemCode = co.ItemUnitId.ItemId.Code, itemName = co.ItemUnitId.ItemId.Name, itemUnit = co.ItemUnitId.UnitId.Name, quantity = co.Credit, price = co.COGSPrice, amount = co.Credit * co.COGSPrice, amountByString = Utility.Accounting.NumberToString(ntos.ToList()[0].total), SaleInvoiceCode = sales.SalesInvoiceId.Code, InventoryName = co.InventoryId.Name, InventoryAddress = co.InventoryId.Address }; try { lst = list.Cast <C02VT>().ToList(); } catch { } } _02_VT report = new _02_VT(); report.DataSource = lst; report.DataMember = ""; if (!hOutputCommPrint.Get("print").ToString().Equals("inventory")) { XPQuery <SalesInvoiceInventoryAccountingTransaction> purchaseInvoiceInventoryAccountingTransaction = new XPQuery <SalesInvoiceInventoryAccountingTransaction>(session); XPQuery <NAS.DAL.Accounting.Journal.GeneralJournal> generalJournal = new XPQuery <NAS.DAL.Accounting.Journal.GeneralJournal>(session); var listg = from p in purchaseInvoiceInventoryAccountingTransaction.AsEnumerable() join g in generalJournal.AsEnumerable() on p.TransactionId equals g.TransactionId.TransactionId where p.SalesInvoiceInventoryTransactionId.InventoryTransactionId == Guid.Parse(hOutputCommId.Get("id").ToString()) orderby g.Credit, g.Debit select new { Dc = g.Debit > g.Credit ? "Nợ :" : "Có :", Account = g.AccountId.Code, Amount = Math.Max(g.Debit, g.Credit) }; grdBooking.DataSource = listg.ToList(); grdBooking.DataBind(); report.pccData.PrintableComponent = new PrintableComponentLinkBase() { Component = gvDataExporter }; } rptOutputCommViewer.Report = report; rptOutputCommViewer.DataBind(); hOutputCommPrint.Remove("print"); cpOutputCommReport.JSProperties.Add("cpShowForm", "form"); } if (Session["BillId"] != null) { BillItemXDS.CriteriaParameters["BillId"].DefaultValue = Session["BillId"].ToString(); } }
protected void Page_Load(object sender, EventArgs e) { if (IsPostBack) { if (hInputCommPrint.Contains("print") && hInputCommId.Contains("id")) { List <C01VT> lst = new List <C01VT>(); if (hInputCommPrint.Get("print").ToString().Equals("inventory")) { XPQuery <PurchaseInvoiceInventoryTransaction> purchaseInvoiceInventoryTransaction = new XPQuery <PurchaseInvoiceInventoryTransaction>(session); XPQuery <InventoryTransaction> queryInventoryTransaction = new XPQuery <InventoryTransaction>(session); XPQuery <BillItem> billItem = new XPQuery <BillItem>(session); XPQuery <InventoryLedger> inventoryLedger = new XPQuery <InventoryLedger>(session); //var list = from pp in purchaseInvoiceInventoryTransaction.AsEnumerable() // join qq in queryInventoryTransaction.AsEnumerable() on pp.InventoryTransactionId equals qq.InventoryTransactionId // join b in billItem.AsEnumerable() on pp.PurchaseInvoiceId.BillId equals b.BillId.BillId // //join i in inventoryLedger.AsEnumerable() on pp.InventoryTransactionId equals i.InventoryTransactionId.InventoryTransactionId // where pp.InventoryTransactionId == Guid.Parse(hInputCommId.Get("id").ToString()) // select new C01VT // { // Code = qq.Code, // CreateDate = qq.CreateDate, // ItemCode = b.ItemUnitId.ItemId.Code, // ItemName = b.ItemUnitId.ItemId.Name, // ItemUnit = b.ItemUnitId.UnitId.Name, // Quantity = b.Quantity, // PurchaseInvoiceCode = pp.PurchaseInvoiceId.Code, // Price = 0, // Amount = 0, // AmountByString = "",//Utility.Accounting.NumberToString(ntos != null ? ntos.ToList()[0].total : 0), // InventoryName = "Kho mặc định", // //InventoryAddress = i.InventoryId.Address, // PurchaseInvoiceDate = pp.PurchaseInvoiceId.IssuedDate, // ReceiverName = pp.PurchaseInvoiceId.TargetOrganizationId.Name // }; Guid billId = Guid.Parse(hInputCommId.Get("id").ToString()); var list = from bi in billItem.AsEnumerable() where bi.BillId != null join pp in purchaseInvoiceInventoryTransaction.AsEnumerable() on bi.BillId.BillId equals pp.PurchaseInvoiceId.BillId join qq in queryInventoryTransaction.AsEnumerable() on pp.InventoryTransactionId equals qq.InventoryTransactionId where pp.InventoryTransactionId == billId select new C01VT { Code = qq.Code, CreateDate = qq.CreateDate, ItemCode = bi.ItemUnitId.ItemId.Code, ItemName = bi.ItemUnitId.ItemId.Name, ItemUnit = bi.ItemUnitId.UnitId.Name, Quantity = bi.Quantity, PurchaseInvoiceCode = pp.PurchaseInvoiceId.Code, Price = 0, Amount = 0, AmountByString = "", //Utility.Accounting.NumberToString(ntos != null ? ntos.ToList()[0].total : 0), InventoryName = "Kho mặc định", ////InventoryAddress = i.InventoryId.Address, PurchaseInvoiceDate = pp.PurchaseInvoiceId.IssuedDate, ReceiverName = pp.PurchaseInvoiceId.TargetOrganizationId.Name }; try { lst = list.ToList(); } catch { } } else { XPQuery <PurchaseInvoiceInventoryTransaction> purchaseInvoiceInventoryTransaction = new XPQuery <PurchaseInvoiceInventoryTransaction>(session); XPQuery <InventoryTransaction> queryInventoryTransaction = new XPQuery <InventoryTransaction>(session); XPQuery <BillItem> billItem = new XPQuery <BillItem>(session); XPQuery <BillItem> sum = new XPQuery <BillItem>(session); var ntos = from s in sum.AsEnumerable() join pp in purchaseInvoiceInventoryTransaction.AsEnumerable() on s.BillId.BillId equals pp.PurchaseInvoiceId.BillId where pp.InventoryTransactionId == Guid.Parse(hInputCommId.Get("id").ToString()) group s by s.BillId.BillId into g select new { total = g.Sum(x => x.Quantity * x.Price * (x.PromotionInPercentage > 0 ? 1 - x.PromotionInPercentage / 100 : 1)) }; double total = 0; try { total = ntos.ToList()[0].total; } catch { } //var list = from pp in purchaseInvoiceInventoryTransaction.AsEnumerable() // join qq in queryInventoryTransaction.AsEnumerable() on pp.InventoryTransactionId equals qq.InventoryTransactionId // join b in billItem.AsEnumerable() on pp.PurchaseInvoiceId.BillId equals b.BillId.BillId // //join i in inventoryLedger.AsEnumerable() on pp.InventoryTransactionId equals i.InventoryTransactionId.InventoryTransactionId // where pp.InventoryTransactionId == Guid.Parse(hInputCommId.Get("id").ToString()) // select new C01VT // { // Code = qq.Code, // CreateDate = qq.CreateDate, // ItemCode = b.ItemUnitId.ItemId.Code, // ItemName = b.ItemUnitId.ItemId.Name, // ItemUnit = b.ItemUnitId.UnitId.Name, // Quantity = b.Quantity, // PurchaseInvoiceCode = pp.PurchaseInvoiceId.Code, // Price = b.Price * (b.PromotionInPercentage > 0 ? 1 - b.PromotionInPercentage / 100 : 1), // Amount = b.Quantity * b.Price * (b.PromotionInPercentage > 0 ? 1 - b.PromotionInPercentage / 100 : 1), // AmountByString = Utility.Accounting.NumberToString(total), // InventoryName = "Kho mặc định", // //InventoryAddress = i.InventoryId.Address, // PurchaseInvoiceDate = pp.PurchaseInvoiceId.IssuedDate, // ReceiverName = pp.PurchaseInvoiceId.TargetOrganizationId.Name // }; //try //{ // lst = list.Cast<C01VT>().ToList().Distinct().ToList(); //} //catch //{ //} Guid billId = Guid.Parse(hInputCommId.Get("id").ToString()); var list = from bi in billItem.AsEnumerable() where bi.BillId != null join pp in purchaseInvoiceInventoryTransaction.AsEnumerable() on bi.BillId.BillId equals pp.PurchaseInvoiceId.BillId join qq in queryInventoryTransaction.AsEnumerable() on pp.InventoryTransactionId equals qq.InventoryTransactionId where pp.InventoryTransactionId == billId select new C01VT { Code = qq.Code, CreateDate = qq.CreateDate, ItemCode = bi.ItemUnitId.ItemId.Code, ItemName = bi.ItemUnitId.ItemId.Name, ItemUnit = bi.ItemUnitId.UnitId.Name, Quantity = bi.Quantity, PurchaseInvoiceCode = pp.PurchaseInvoiceId.Code, Price = bi.Price * (bi.PromotionInPercentage > 0 ? 1 - bi.PromotionInPercentage / 100 : 1), Amount = bi.Quantity * bi.Price * (bi.PromotionInPercentage > 0 ? 1 - bi.PromotionInPercentage / 100 : 1), AmountByString = Utility.Accounting.NumberToString(total), InventoryName = "Kho mặc định", ////InventoryAddress = i.InventoryId.Address, PurchaseInvoiceDate = pp.PurchaseInvoiceId.IssuedDate, ReceiverName = pp.PurchaseInvoiceId.TargetOrganizationId.Name }; try { lst = list.ToList(); } catch { } } _01_VT report = new _01_VT(); report.DataSource = lst; report.DataMember = ""; if (!hInputCommPrint.Get("print").ToString().Equals("inventory")) { XPQuery <PurchaseInvoiceInventoryAccountingTransaction> purchaseInvoiceInventoryAccountingTransaction = new XPQuery <PurchaseInvoiceInventoryAccountingTransaction>(session); XPQuery <NAS.DAL.Accounting.Journal.GeneralJournal> generalJournal = new XPQuery <NAS.DAL.Accounting.Journal.GeneralJournal>(session); var listg = from p in purchaseInvoiceInventoryAccountingTransaction.AsEnumerable() join g in generalJournal.AsEnumerable() on p.TransactionId equals g.TransactionId.TransactionId where p.PurchaseInvoiceInventoryTransactionId.InventoryTransactionId == Guid.Parse(hInputCommId.Get("id").ToString()) orderby g.Credit, g.Debit select new { Dc = g.Debit > g.Credit ? "Nợ :" : "Có :", Account = g.AccountId.Code, Amount = Math.Max(g.Debit, g.Credit) }; grdBooking.DataSource = listg.ToList(); grdBooking.DataBind(); report.pccData.PrintableComponent = new PrintableComponentLinkBase() { Component = gvDataExporter }; } rptInpuCommViewer.Report = report; rptInpuCommViewer.DataBind(); hInputCommPrint.Remove("print"); cpInpuCommReport.JSProperties.Add("cpShowForm", "form"); } if (Session["BillId"] != null) { BillItemXDS.CriteriaParameters["BillId"].DefaultValue = Session["BillId"].ToString(); } } }
protected void cpInvoiceVatList_Callback(object sender, DevExpress.Web.ASPxClasses.CallbackEventArgsBase e) { string[] para = e.Parameter.Split('|'); if (para[0] != "") { XPQuery <NAS.DAL.Accounting.LegalInvoice.LegalInvoiceArtifactType> legalInvoiceArtifactType = new XPQuery <NAS.DAL.Accounting.LegalInvoice.LegalInvoiceArtifactType>(session); XPQuery <BillTaxClaim> billTaxClaim = new XPQuery <BillTaxClaim>(session); XPQuery <SaleInvoiceArtiface> saleInvoiceArtiface = new XPQuery <SaleInvoiceArtiface>(session); char vatType = (para[0] == "01-1/GTGT" ? Constant.VAT_OUT : Constant.VAT_IN); var list = from liat in legalInvoiceArtifactType.Where(l => l.RowStatus >= 1).AsEnumerable() join sia in saleInvoiceArtiface.Where(s => s.LegalInvoiceArtifactTypeId.Category == vatType).AsEnumerable() on liat.LegalInvoiceArtifactTypeId equals sia.LegalInvoiceArtifactTypeId.LegalInvoiceArtifactTypeId join btc in billTaxClaim.AsEnumerable().DefaultIfEmpty(new BillTaxClaim(session)) on sia.BillId.BillId equals btc.BillId.BillId //where g.LegalInvoiceArtifactTypeId.Category == vatType //from gg in g.DefaultIfEmpty(new BillTaxClaim(session)) select new C011GTGT() { Amount = btc.Amount, ClaimItem = btc.ClaimItem, Comment = btc.Comment, CreateDate = btc.CreateDate, TaxInNumber = btc.TaxInNumber, TaxInPercentage = btc.TaxInPercentage, TotalAmount = btc.TotalAmount, BillCode = sia.IssuedArtifaceCode, SeriesNumber = sia.SeriesNumber, ObjectName = btc.BillId.SourceOrganizationId.Name, ObjectTax = btc.BillId.SourceOrganizationId.TaxNumber, LegalInvoiceArtifactTypeCode = liat.Code, LegalInvoiceArtifactTypeName = liat.Name }; try { CriteriaOperator _filter = new GroupOperator(GroupOperatorType.And, new BinaryOperator("Category", vatType, BinaryOperatorType.Equal), new BinaryOperator("RowStatus", 1, BinaryOperatorType.GreaterOrEqual)); XPCollection <NAS.DAL.Accounting.LegalInvoice.LegalInvoiceArtifactType> _legalInvoiceArtifactType = new XPCollection <NAS.DAL.Accounting.LegalInvoice.LegalInvoiceArtifactType>(session); _legalInvoiceArtifactType.Criteria = _filter; var _result = list; foreach (NAS.DAL.Accounting.LegalInvoice.LegalInvoiceArtifactType liat in _legalInvoiceArtifactType) { if (!list.ToList().Any(l => l.LegalInvoiceArtifactTypeCode == liat.Code)) { C011GTGT _c011GTGT = new C011GTGT() { Amount = 0, ClaimItem = "", Comment = "", CreateDate = DateTime.Now, TaxInNumber = 0, TaxInPercentage = 0, TotalAmount = 0, BillCode = "", SeriesNumber = "", ObjectName = "", ObjectTax = "", LegalInvoiceArtifactTypeCode = liat.Code, LegalInvoiceArtifactTypeName = liat.Name }; _result = _result.Concat(new List <C011GTGT> { _c011GTGT }); } } grdBillTaxClaim.DataSource = _result.ToList(); grdBillTaxClaim.DataBind(); grdBillTaxClaim.ExpandAll(); Session["data"] = _result.ToList(); cpInvoiceVatList.JSProperties.Add("cpShowForm", "show"); } catch { } } }