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 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 { } } }