private void showReport(string reportType)
        {
            var ExLC = dbEntities.findExportLC(tbLCCode.Text);
            var BCustomer = dbEntities.BCUSTOMERS.Find(ExLC.BeneficiaryNo);
            if (ExLC == null)
            {
                lblLCCodeMessage.Text = "Can not find this LC.";
                return;
            }
            //
            string reportTemplate = "~/DesktopModules/TrainingCoreBanking/BankProject/Report/Template/Export/";
            string reportSaveName = "";
            DataSet reportData = new DataSet();
            DataTable tbl1 = new DataTable();
            Aspose.Words.SaveFormat saveFormat = Aspose.Words.SaveFormat.Doc;
            Aspose.Words.SaveType saveType = Aspose.Words.SaveType.OpenInApplication;
            try
            {
                switch (reportType)
                {
                    case "ThuThongBao":
                        reportTemplate = Context.Server.MapPath(reportTemplate + "Mau Thong bao LC.doc");
                        reportSaveName = "ThuThongBao" + "_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".doc";
                        //
                        var dataThuThongBao = new Model.Reports.MauThongBaoVaTuChinhLc()
                        {
                            DateCreate = (ExLC.CreateDate.HasValue ? ExLC.CreateDate.Value.ToString("dd/MM/yyyy") : ""),
                            Ref = ExLC.ExportLCCode,
                            Beneficiary = ExLC.BeneficiaryName,
                            LCCode = ExLC.ImportLCCode,
                            DateOfIssue = (ExLC.DateOfIssue.HasValue ? ExLC.DateOfIssue.Value.ToString("dd/MM/yyyy") : ""),
                            DateOfExpiry = (ExLC.DateOfExpiry.HasValue ? ExLC.DateOfExpiry.Value.ToString("dd/MM/yyyy") : ""),
                            IssuingBank = ExLC.IssuingBankName,
                            Amount = ExLC.Amount + " " + ExLC.Currency,
                            Applicant = ExLC.ApplicantName
                        };
                        if (!string.IsNullOrEmpty(ExLC.BeneficiaryAddr1)) dataThuThongBao.Beneficiary += ", " + ExLC.BeneficiaryAddr1;
                        if (!string.IsNullOrEmpty(ExLC.BeneficiaryAddr2)) dataThuThongBao.Beneficiary += ", " + ExLC.BeneficiaryAddr2;
                        if (!string.IsNullOrEmpty(ExLC.BeneficiaryAddr3)) dataThuThongBao.Beneficiary += ", " + ExLC.BeneficiaryAddr3;

                        if (!string.IsNullOrEmpty(ExLC.IssuingBankAddr1)) dataThuThongBao.IssuingBank += ", " + ExLC.IssuingBankAddr1;
                        if (!string.IsNullOrEmpty(ExLC.IssuingBankAddr2)) dataThuThongBao.IssuingBank += ", " + ExLC.IssuingBankAddr2;
                        if (!string.IsNullOrEmpty(ExLC.IssuingBankAddr3)) dataThuThongBao.IssuingBank += ", " + ExLC.IssuingBankAddr3;

                        if (!string.IsNullOrEmpty(ExLC.ApplicantAddr1)) dataThuThongBao.Applicant += ", " + ExLC.ApplicantAddr1;
                        if (!string.IsNullOrEmpty(ExLC.ApplicantAddr2)) dataThuThongBao.Applicant += ", " + ExLC.ApplicantAddr2;
                        if (!string.IsNullOrEmpty(ExLC.ApplicantAddr3)) dataThuThongBao.Applicant += ", " + ExLC.ApplicantAddr3;
                        //
                        var lstData = new List<Model.Reports.MauThongBaoVaTuChinhLc>();
                        lstData.Add(dataThuThongBao);
                        tbl1 = Utils.CreateDataTable<Model.Reports.MauThongBaoVaTuChinhLc>(lstData);
                        reportData.Tables.Add(tbl1);
                        break;
                    case "BiaHs":
                        reportTemplate = Context.Server.MapPath(reportTemplate + "Mau Bia hs lc.doc");
                        reportSaveName = "BiaHs" + "_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".doc";
                        //
                        var dataBiaHs = new Model.Reports.MauBiaHsLc()
                        {
                            Ref = ExLC.ExportLCCode,
                            LCCode = ExLC.ImportLCCode,
                            DateOfIssue = (ExLC.DateOfIssue.HasValue ? ExLC.DateOfIssue.Value.ToString("dd/MM/yyyy") : ""),
                            Beneficiary = ExLC.BeneficiaryName,
                            Applicant = ExLC.ApplicantName,
                            IssuingBank = ExLC.IssuingBankName,
                            Tenor = ExLC.Tenor,
                            AdvisingBank = ExLC.AdvisingBankName,
                            Amount = ExLC.Amount + " " + ExLC.Currency,
                            LatestDateOfShipment = (ExLC.LatesDateOfShipment.HasValue ? ExLC.LatesDateOfShipment.Value.ToString("dd/MM/yyyy") : ""),
                            DateOfExpiry = (ExLC.DateOfExpiry.HasValue ? ExLC.DateOfExpiry.Value.ToString("dd/MM/yyyy") : ""),
                            Transhipment = ExLC.TranShipment,
                            PartialShipment = ExLC.PartialShipment,
                            Commodity = ExLC.Commodity,
                            PortOfLoading = ExLC.PortOfLoading,
                            PeriodForPresentation = ExLC.PeriodForPresentation,
                            PortOfDischarge = ExLC.PortOfDischarge
                        };
                        if (!string.IsNullOrEmpty(ExLC.Commodity))
                        {
                            var bc = dbEntities.BCOMMODITies.FirstOrDefault(p => p.ID.Equals(ExLC.Commodity));
                            if (bc != null) dataBiaHs.Commodity = bc.Name;
                        }

                        if (!string.IsNullOrEmpty(ExLC.BeneficiaryAddr1)) dataBiaHs.Beneficiary += ", " + ExLC.BeneficiaryAddr1;
                        if (!string.IsNullOrEmpty(ExLC.BeneficiaryAddr2)) dataBiaHs.Beneficiary += ", " + ExLC.BeneficiaryAddr2;
                        if (!string.IsNullOrEmpty(ExLC.BeneficiaryAddr3)) dataBiaHs.Beneficiary += ", " + ExLC.BeneficiaryAddr3;

                        if (!string.IsNullOrEmpty(ExLC.IssuingBankAddr1)) dataBiaHs.IssuingBank += ", " + ExLC.IssuingBankAddr1;
                        if (!string.IsNullOrEmpty(ExLC.IssuingBankAddr2)) dataBiaHs.IssuingBank += ", " + ExLC.IssuingBankAddr2;
                        if (!string.IsNullOrEmpty(ExLC.IssuingBankAddr3)) dataBiaHs.IssuingBank += ", " + ExLC.IssuingBankAddr3;

                        if (!string.IsNullOrEmpty(ExLC.ApplicantAddr1)) dataBiaHs.Applicant += ", " + ExLC.ApplicantAddr1;
                        if (!string.IsNullOrEmpty(ExLC.ApplicantAddr2)) dataBiaHs.Applicant += ", " + ExLC.ApplicantAddr2;
                        if (!string.IsNullOrEmpty(ExLC.ApplicantAddr3)) dataBiaHs.Applicant += ", " + ExLC.ApplicantAddr3;

                        if (!string.IsNullOrEmpty(ExLC.AdvisingBankAddr1)) dataBiaHs.AdvisingBank += ", " + ExLC.AdvisingBankAddr1;
                        if (!string.IsNullOrEmpty(ExLC.AdvisingBankAddr2)) dataBiaHs.AdvisingBank += ", " + ExLC.AdvisingBankAddr2;
                        if (!string.IsNullOrEmpty(ExLC.AdvisingBankAddr3)) dataBiaHs.AdvisingBank += ", " + ExLC.AdvisingBankAddr3;
                        //
                        var lstData1 = new List<Model.Reports.MauBiaHsLc>();
                        lstData1.Add(dataBiaHs);
                        tbl1 = Utils.CreateDataTable<Model.Reports.MauBiaHsLc>(lstData1);
                        reportData.Tables.Add(tbl1);
                        break;
                    case "VAT":
                        reportTemplate = Context.Server.MapPath(reportTemplate + "VAT.doc");
                        reportSaveName = "VAT" + "_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".doc";
                        //
                        var dataVAT = new Model.Reports.VAT()
                        {
                            UserName = ExLC.CreateBy,
                            VATNo = ExLC.VATNo,
                            TransCode = ExLC.ExportLCCode,
                            //
                            CustomerID = ExLC.BeneficiaryNo,
                            CustomerName = ExLC.BeneficiaryName,
                            CustomerAddress = ExLC.BeneficiaryAddr1 + " " + ExLC.BeneficiaryAddr2 + " " + ExLC.BeneficiaryAddr3,
                            IdentityNo = null == BCustomer ? "" : BCustomer.IdentityNo,
                            //
                            DebitAccount = null == BCustomer ? "" : BCustomer.BankAccount,
                            ChargeRemarks = ExLC.ChargeRemarks
                        };
                        //
                        var ExLCCharges = dbEntities.BEXPORT_LC_CHARGES.Where(p => p.ExportLCCode.Equals(tbLCCode.Text));
                        if (ExLCCharges != null)
                        {
                            double TotalTaxAmount = 0, TotalChargeAmount = 0;
                            String currency = "";
                            foreach (BEXPORT_LC_CHARGES ch in ExLCCharges)
                            {
                                if (ch.ChargeAmt.HasValue && ch.ChargeAmt.Value != 0)
                                {
                                    if (string.IsNullOrEmpty(dataVAT.ChargeType1))
                                    {
                                        dataVAT.ChargeType1 = dbEntities.getChargeTypeInfo(ch.ChargeCode, 1);
                                        dataVAT.ChargeAmount1 = Utils.CurrencyFormat(ch.ChargeAmt.Value, ch.ChargeCcy) + ch.ChargeCcy + " " + dbEntities.getChargeTypeInfo(ch.ChargeCode, 2);
                                        if (ch.TaxAmt.HasValue) TotalTaxAmount += ch.TaxAmt.Value;
                                        TotalChargeAmount += ch.ChargeAmt.Value;
                                        currency = ch.ChargeCcy;
                                    }
                                    else if (string.IsNullOrEmpty(dataVAT.ChargeType2))
                                    {
                                        dataVAT.ChargeType2 = dbEntities.getChargeTypeInfo(ch.ChargeCode, 1);
                                        dataVAT.ChargeAmount2 = Utils.CurrencyFormat(ch.ChargeAmt.Value, ch.ChargeCcy) + ch.ChargeCcy + " " + dbEntities.getChargeTypeInfo(ch.ChargeCode, 2);
                                        if (ch.TaxAmt.HasValue) TotalTaxAmount += ch.TaxAmt.Value;
                                        TotalChargeAmount += ch.ChargeAmt.Value;
                                        if (currency.Equals(""))
                                        {
                                            currency = ch.ChargeCcy;
                                        }
                                    }
                                    else if (string.IsNullOrEmpty(dataVAT.ChargeType3))
                                    {
                                        dataVAT.ChargeType3 = dbEntities.getChargeTypeInfo(ch.ChargeCode, 1);
                                        dataVAT.ChargeAmount3 = Utils.CurrencyFormat(ch.ChargeAmt.Value, ch.ChargeCcy) + ch.ChargeCcy + " " + dbEntities.getChargeTypeInfo(ch.ChargeCode, 2);
                                        if (ch.TaxAmt.HasValue) TotalTaxAmount += ch.TaxAmt.Value;
                                        TotalChargeAmount += ch.ChargeAmt.Value;
                                        if (currency.Equals(""))
                                        {
                                            currency = ch.ChargeCcy;
                                        }
                                    }
                                }
                            }
                            TotalChargeAmount += TotalTaxAmount;
                            if (TotalChargeAmount != 0)
                            {
                                dataVAT.TotalChargeAmount = Utils.CurrencyFormat(TotalChargeAmount, currency) + currency;
                                dataVAT.TotalChargeAmountWord = Utils.ReadNumber(currency, TotalChargeAmount);
                                if (TotalTaxAmount != 0)
                                {
                                    dataVAT.TotalTaxAmount = Utils.CurrencyFormat(TotalTaxAmount, currency) + currency + " PL90304";
                                    dataVAT.TotalTaxText = "VAT";
                                }
                            }
                        }

                        //
                        var lstData2 = new List<Model.Reports.VAT>();
                        lstData2.Add(dataVAT);
                        tbl1 = Utils.CreateDataTable<Model.Reports.VAT>(lstData2);
                        reportData.Tables.Add(tbl1);
                        break;
                }
                if (reportData != null)
                {
                    try
                    {
                        reportData.Tables[0].TableName = "Table1";
                        bc.Reports.createFileDownload(reportTemplate, reportData, reportSaveName, saveFormat, saveType, Response);
                    }
                    catch (Exception err)
                    {
                        lblLCCodeMessage.Text = reportData.Tables[0].TableName + "#" + err.Message;
                    }
                }
            }
            catch (Exception ex)
            {
                lblLCCodeMessage.Text = ex.Message;
            }
        }
Ejemplo n.º 2
0
 private void showReport(string reportType)
 {
     var ExLCDocSettlement = dbEntities.findExportLCDocSettlement(tbLCCode.Text);
     if (ExLCDocSettlement == null)
     {
         lblLCCodeMessage.Text = "Can not find this Code.";
         return;
     }
     var ExLCDoc = dbEntities.findExportLCDoc(ExLCDocSettlement.DocsCode);
     //
     string reportTemplate = "~/DesktopModules/TrainingCoreBanking/BankProject/Report/Template/Export/DocumentProcessing/Settlement/";
     string reportSaveName = "";
     DataSet reportData = new DataSet();
     DataTable tbl1 = new DataTable();
     Aspose.Words.SaveFormat saveFormat = Aspose.Words.SaveFormat.Doc;
     Aspose.Words.SaveType saveType = Aspose.Words.SaveType.OpenInApplication;
     try
     {
         switch (reportType)
         {
             case "VAT":
                 reportTemplate = Context.Server.MapPath(reportTemplate + "VAT.doc");
                 reportSaveName = "VAT" + "_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".doc";
                 //
                 var dataVAT = new Model.Reports.VAT()
                 {
                     UserName = ExLCDocSettlement.CreateBy,
                     VATNo = ExLCDocSettlement.VATNo,
                     TransCode = ExLCDocSettlement.PaymentCode,
                     //
                     CustomerID = "",
                     CustomerName = "",
                     CustomerAddress = "",
                     IdentityNo = "",
                     //
                     DebitAccount = "",
                     ChargeRemarks = ExLCDocSettlement.ChargeRemarks
                 };
                 //
                 var ExLCDocCharges = dbEntities.BEXPORT_LC_DOCS_SETTLEMENT_CHARGES.Where(p => p.PaymentCode.Equals(tbLCCode.Text));
                 if (ExLCDocCharges != null)
                 {
                     double TotalTaxAmount = 0, TotalChargeAmount = 0;
                     foreach (BEXPORT_LC_DOCS_SETTLEMENT_CHARGES ch in ExLCDocCharges)
                     {
                         if (ch.ChargeAmt.HasValue && ch.ChargeAmt.Value != 0)
                         {
                             if (string.IsNullOrEmpty(dataVAT.ChargeType1))
                             {
                                 dataVAT.ChargeType1 = dbEntities.getChargeTypeInfo(ch.ChargeCode, 1);
                                 dataVAT.ChargeAmount1 = ch.ChargeAmt.Value + ch.ChargeCcy + " " + dbEntities.getChargeTypeInfo(ch.ChargeCode, 2);
                                 if (ch.TaxAmt.HasValue) TotalTaxAmount += ch.TaxAmt.Value;
                                 TotalChargeAmount += ch.ChargeAmt.Value;
                             }
                             else if (string.IsNullOrEmpty(dataVAT.ChargeType2))
                             {
                                 dataVAT.ChargeType2 = dbEntities.getChargeTypeInfo(ch.ChargeCode, 1);
                                 dataVAT.ChargeAmount2 = ch.ChargeAmt.Value + ch.ChargeCcy + " " + dbEntities.getChargeTypeInfo(ch.ChargeCode, 2);
                                 if (ch.TaxAmt.HasValue) TotalTaxAmount += ch.TaxAmt.Value;
                                 TotalChargeAmount += ch.ChargeAmt.Value;
                             }
                             else if (string.IsNullOrEmpty(dataVAT.ChargeType3))
                             {
                                 dataVAT.ChargeType3 = dbEntities.getChargeTypeInfo(ch.ChargeCode, 1);
                                 dataVAT.ChargeAmount3 = ch.ChargeAmt.Value + ch.ChargeCcy + " " + dbEntities.getChargeTypeInfo(ch.ChargeCode, 2);
                                 if (ch.TaxAmt.HasValue) TotalTaxAmount += ch.TaxAmt.Value;
                                 TotalChargeAmount += ch.ChargeAmt.Value;
                             }
                         }
                     }
                     TotalChargeAmount += TotalTaxAmount;
                     if (TotalChargeAmount != 0)
                     {
                         dataVAT.TotalChargeAmount = TotalChargeAmount + ExLCDoc.Currency;
                         dataVAT.TotalChargeAmountWord = Utils.ReadNumber(ExLCDoc.Currency, TotalChargeAmount);
                         if (TotalTaxAmount != 0)
                         {
                             dataVAT.TotalTaxAmount = TotalTaxAmount + ExLCDoc.Currency + " PL90304";
                             dataVAT.TotalTaxText = "VAT";
                         }
                     }
                 }
                 //
                 var lstData2 = new List<Model.Reports.VAT>();
                 lstData2.Add(dataVAT);
                 tbl1 = Utils.CreateDataTable<Model.Reports.VAT>(lstData2);
                 reportData.Tables.Add(tbl1);
                 break;
         }
         if (reportData != null)
         {
             try
             {
                 reportData.Tables[0].TableName = "Table1";
                 bc.Reports.createFileDownload(reportTemplate, reportData, reportSaveName, saveFormat, saveType, Response);
             }
             catch (Exception err)
             {
                 lblLCCodeMessage.Text = reportData.Tables[0].TableName + "#" + err.Message;
             }
         }
     }
     catch (Exception ex)
     {
         lblLCCodeMessage.Text = ex.Message;
     }
 }
        private void showReport(string reportType)
        {
            var ExLCDoc = dbEntities.findExportLCDoc(tbLCCode.Text);
            var BCustomer = dbEntities.BCUSTOMERS.Find(ExLCDoc.BeneficiaryNo);
            if (ExLCDoc == null)
            {
                lblLCCodeMessage.Text = "Can not find this Code.";
                return;
            }
            //
            string reportTemplate = "~/DesktopModules/TrainingCoreBanking/BankProject/Report/Template/Export/DocumentProcessing/";
            string reportSaveName = "";
            DataSet reportData = new DataSet();
            DataTable tbl1 = new DataTable();
            Aspose.Words.SaveFormat saveFormat = Aspose.Words.SaveFormat.Doc;
            Aspose.Words.SaveType saveType = Aspose.Words.SaveType.OpenInApplication;
            try
            {
                switch (reportType)
                {
                    case "VAT":
                        reportTemplate = Context.Server.MapPath(reportTemplate + "VAT.doc");
                        reportSaveName = "VAT" + "_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".doc";
                        //
                        var dataVAT = new Model.Reports.VAT()
                        {
                            UserName = ExLCDoc.CreateBy,
                            VATNo = ExLCDoc.VATNo,
                            TransCode = ExLCDoc.DocCode,
                            //
                            CustomerID = ExLCDoc.BeneficiaryNo,
                            CustomerName = ExLCDoc.BeneficiaryName,
                            CustomerAddress = ExLCDoc.BeneficiaryAddr1 + " " + ExLCDoc.BeneficiaryAddr2 + " " + ExLCDoc.BeneficiaryAddr3,
                            IdentityNo = null == BCustomer ? "" : BCustomer.IdentityNo,
                            //
                            DebitAccount = null,// == BCustomer ? "" : BCustomer.BankAccount,
                            ChargeRemarks = ExLCDoc.ChargeRemarks
                        };
                        //
                        var ExLCDocCharges = dbEntities.BEXPORT_LC_DOCS_PROCESSING_CHARGES.Where(p => p.DocsCode.Equals(tbLCCode.Text));
                        if (ExLCDocCharges != null)
                        {
                            double TotalTaxAmount = 0, TotalChargeAmount = 0;
                            String currency = "";
                            foreach (BEXPORT_LC_DOCS_PROCESSING_CHARGES ch in ExLCDocCharges)
                            {
                                if (ch.ChargeAmt.HasValue && ch.ChargeAmt.Value != 0)
                                {
                                    if (string.IsNullOrEmpty(dataVAT.ChargeType1))
                                    {
                                        dataVAT.ChargeType1 = dbEntities.getChargeTypeInfo(ch.ChargeCode, 1);
                                        dataVAT.ChargeAmount1 = Utils.CurrencyFormat(ch.ChargeAmt.Value, ch.ChargeCcy) + " "
                                            + ch.ChargeCcy + " " + dbEntities.getChargeTypeInfo(ch.ChargeCode, 2);
                                        if (ch.TaxAmt.HasValue) TotalTaxAmount += ch.TaxAmt.Value;
                                        TotalChargeAmount += ch.ChargeAmt.Value;
                                        currency = ch.ChargeCcy;
                                        dataVAT.DebitAccount = ch.ChargeAcc;
                                    }
                                    else if (string.IsNullOrEmpty(dataVAT.ChargeType2))
                                    {
                                        dataVAT.ChargeType2 = dbEntities.getChargeTypeInfo(ch.ChargeCode, 1);
                                        dataVAT.ChargeAmount2 = Utils.CurrencyFormat(ch.ChargeAmt.Value, ch.ChargeCcy) + " "
                                            + ch.ChargeCcy + " " + dbEntities.getChargeTypeInfo(ch.ChargeCode, 2);
                                        if (ch.TaxAmt.HasValue) TotalTaxAmount += ch.TaxAmt.Value;
                                        TotalChargeAmount += ch.ChargeAmt.Value;
                                        if (currency.Equals(""))
                                        {
                                            currency = ch.ChargeCcy;
                                        }
                                        dataVAT.DebitAccount = ch.ChargeAcc;
                                    }
                                    else if (string.IsNullOrEmpty(dataVAT.ChargeType3))
                                    {
                                        dataVAT.ChargeType3 = dbEntities.getChargeTypeInfo(ch.ChargeCode, 1);
                                        dataVAT.ChargeAmount3 = Utils.CurrencyFormat(ch.ChargeAmt.Value, ch.ChargeCcy) + " "
                                            + ch.ChargeCcy + " " + dbEntities.getChargeTypeInfo(ch.ChargeCode, 2);
                                        if (ch.TaxAmt.HasValue) TotalTaxAmount += ch.TaxAmt.Value;
                                        TotalChargeAmount += ch.ChargeAmt.Value;
                                        if (currency.Equals(""))
                                        {
                                            currency = ch.ChargeCcy;
                                        }
                                        dataVAT.DebitAccount = ch.ChargeAcc;
                                    }
                                }
                            }
                            TotalChargeAmount += TotalTaxAmount;
                            if (TotalChargeAmount != 0)
                            {
                                dataVAT.TotalChargeAmount = Utils.CurrencyFormat(TotalChargeAmount, currency) + currency;
                                dataVAT.TotalChargeAmountWord = Utils.ReadNumber(currency, TotalChargeAmount);
                                if (TotalTaxAmount != 0)
                                {
                                    dataVAT.TotalTaxAmount = Utils.CurrencyFormat(TotalTaxAmount, currency) + " " +  currency + " PL90304";
                                    dataVAT.TotalTaxText = "VAT";
                                }
                            }
                        }
                        //
                        var lstData2 = new List<Model.Reports.VAT>();
                        lstData2.Add(dataVAT);
                        tbl1 = Utils.CreateDataTable<Model.Reports.VAT>(lstData2);
                        reportData.Tables.Add(tbl1);
                        break;

                    case "XuatNgoaiBang":
                    case "NhapNgoaiBang":

                        reportTemplate = Context.Server.MapPath(reportTemplate +  reportType + ".doc");
                        reportSaveName = reportType + "_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".doc";

                        var dataXuatNgoaiBang = new Model.Reports.PhieuXuatNgoaiBang()
                        {
                            DocCode = ExLCDoc.DocCode,
                            CustomerName = BCustomer.CustomerName,
                            CurrentUserLogin = ExLCDoc.CreateBy,
                            ApplicantName = ExLCDoc.ApplicantName,
                            IdentityNo = BCustomer.IdentityNo,
                            ApplicantAddr1 = BCustomer.Address,
                            ApplicantAddr2 = BCustomer.City,
                            ApplicantAddr3 = BCustomer.Country,
                            Currency = ExLCDoc.Currency
                        };

                        double oldAmount = 0;

                        if (null != ExLCDoc.AmendNoOriginal)
                        {
                            var ExLCDocOld = dbEntities.findExportLCDoc(ExLCDoc.AmendNoOriginal, true);
                            oldAmount = ExLCDocOld.Amount.Value;
                        }

                        if(reportType.Equals("XuatNgoaiBang"))
                        {
                            dataXuatNgoaiBang.Amount = oldAmount - ExLCDoc.Amount.Value;
                        }
                        else
                        {
                            dataXuatNgoaiBang.Amount = ExLCDoc.Amount.Value - oldAmount;
                        }

                        var lstData = new List<Model.Reports.PhieuXuatNgoaiBang>();
                        lstData.Add(dataXuatNgoaiBang);
                        tbl1 = Utils.CreateDataTable<Model.Reports.PhieuXuatNgoaiBang>(lstData);
                        reportData.Tables.Add(tbl1);
                        break;
                }
                if (reportData != null)
                {
                    try
                    {
                        reportData.Tables[0].TableName = "Table1";
                        bc.Reports.createFileDownload(reportTemplate, reportData, reportSaveName, saveFormat, saveType, Response);
                    }
                    catch (Exception err)
                    {
                        lblLCCodeMessage.Text = reportData.Tables[0].TableName + "#" + err.Message;
                    }
                }
            }
            catch (Exception ex)
            {
                lblLCCodeMessage.Text = ex.Message;
            }
        }