private void btProcess_Click ( object sender, EventArgs e ) { { /* Điều kiện kiểm tra * B1: kiểm tra trong ổ D:\KTT\SEND_EMAIL\BTBGD\yyyymmdd đã xử lý với ngày hiện tại chưa * Nếu đã xử lý: Không cho xử lý nữa * B2: Kiểm tra trong bảng NAB_CREDIT_SENDMAIL đã xử lý với ngày hiện tại chưa? Nếu rồi--> Không xử lý * Xử lý tạo file pdf và lưu vào đường dẫn trên D:\KTT\SEND_EMAIL\BTBGD\yyyymmdd\số thẻ.pdf * */ //B1: Kiểm tra đường dẫn đã tồn tại chưa? this.Cursor = Cursors.WaitCursor; string folderOut = tbFilePath.Text.Trim ( ); if (Directory.Exists ( folderOut )) { MessageBox.Show ( "Đã xử lý SendMail ngày " + DateTime.Now.ToString ( "yyyyMMdd" ) ); this.Cursor = Cursors.Default; return; // Directory.CreateDirectory(folderOut); } string sql = "", err = ""; sql += " select * from NAB_CREDIT_SENDMAIL a"; sql += " where trunc(a.DATE_CREATE)=trunc(sysdate)"; // sql += " and trunc(sysdate)>=(select trunc(max(b.stat_date)) from cr_term b)"; DataTable dt = Businessbp.executedb.getTable ( sql, ref err ); if (err != "") { MessageBox.Show ( err ); this.Cursor = Cursors.Default; return; } else { if (dt.Rows.Count > 0) { MessageBox.Show ( "Đã xử lý SendMail ngày " + DateTime.Now.ToString ( "yyyyMMdd" ) ); this.Cursor = Cursors.Default; return; } else { //Xử lý và insert vào table //tạo thư mục Directory.CreateDirectory ( folderOut ); try { sql = ""; err = ""; #region 2014-10-28 (6) new sql += " select distinct a.cr_account_nbr "; sql += " ,acc.id "; sql += " ,to_char(a.stat_date, 'dd/mm/yyyy') DATE_START"; sql += " ,to_char(a.stat_date, 'dd/mm/yyyy') BILL_DATE"; sql += " from nab_billing_credit_log a "; sql += " ," + Businessbp.executedb.owner + "acnt_contract acc "; sql += " where a.cr_account_nbr = acc.contract_number "; sql += " and a.stat_date = to_date('" + dtpckDate.Text.Trim ( ) + "', 'dd/mm/yyyy') "; sql += " and acc.amnd_state = 'A' "; sql += " and acc.con_cat = 'A' "; sql += " and (a.total_debit + a.fee + a.bal_payment + abs(a.closing_bal)) <> 0"; sql += " "; #endregion 2014-10-28 (6) new DataTable dt_card_process = Businessbp.executedb.getTable ( sql, ref err ); if (err != "") { MessageBox.Show ( err ); this.Cursor = Cursors.Default; return; } else { if (dt_card_process.Rows.Count <= 0) { MessageBox.Show ( "Chưa xử lý cuối ngày." ); this.Cursor = Cursors.Default; return; } else { DataTable dt_bill = new DataTable ( ); for (int i = 0; i < dt_card_process.Rows.Count; i++) { sql = ""; err = ""; sql += " select 1 "; sql += " from " + Businessbp.executedb.owner + "contract_addresses ca "; sql += " where ca.acnt_contract__oid = '" + dt_card_process.Rows[i]["id"].ToString ( ) + "' "; sql += " and ca.address_type__id = '1' "; sql += " and instr(ca.e_mail,'@',1) > 0 "; DataTable dt_email = Businessbp.executedb.getTable ( sql, ref err ); if (err != "") { MessageBox.Show ( err ); this.Cursor = Cursors.Default; return; } else { pbProcess.Minimum = 0; pbProcess.Maximum = dt_card_process.Rows.Count; pbProcess.Value = 1; pbProcess.Step = 1; if (dt_email.Rows.Count > 0) { int min = (int)( (double)pbProcess.Value ); int max = (int)( (double)pbProcess.Maximum ); pbProcess.CreateGraphics ( ).DrawString ( min.ToString ( ) + "/" + max.ToString ( ), new Font ( "Arial", (float)10, FontStyle.Regular ), Brushes.Black, new PointF ( pbProcess.Width / 2 - 10, pbProcess.Height / 2 - 7 ) ); pbProcess.PerformStep ( ); string cr_account_nbr = dt_card_process.Rows[i]["cr_account_nbr"].ToString ( ); string id = dt_card_process.Rows[i]["id"].ToString ( ); sql = ""; err = ""; if (DateTime.ParseExact ( dtpckDate.Text.Trim ( ), "dd/MM/yyyy", CultureInfo.InvariantCulture ) < DateTime.ParseExact ( "24/09/2015", "dd/MM/yyyy", CultureInfo.InvariantCulture )) // 2015-09-08 (12) { #region 08-09-2015 //sql += "select distinct A.*, "; //sql += " case "; //sql += " when (A.date_create 90 < add_months(to_date(A.processing_date, "; //sql += " 'dd/mm/yyyy'), "; //sql += " -1)) then "; //sql += " '0' "; //sql += " else "; //sql += " to_char(decode(decode(A.machinhsachtd, "; //sql += " 'B01 - STK - UU DAI', "; //sql += " '1', "; //sql += " '0'), "; //sql += " '1', "; //sql += " nab_pck_out.nab_func_getcashback_amt(A.cr_account_nbr, "; //sql += " to_char(add_months(to_date(A.processing_date, "; //sql += " 'dd/mm/yyyy'), "; //sql += " -1) 1, "; //sql += " 'dd/mm/yyyy'), "; //sql += " to_char(least(A.date_create 90, "; //sql += " to_date(A.processing_date, "; //sql += " 'dd/mm/yyyy')), "; //sql += " 'dd/mm/yyyy')), "; //sql += " 0), "; //sql += " '999,999,999,999') "; //sql += " end cashback "; //sql += " from (select substr(r.card_number, 1, 4) || 'xxxxxxxx' || "; //sql += " substr(r.card_number, 13, 4) card_number, "; //sql += " r.embossed_name, "; //sql += " r.credit_limit, "; //sql += " r.processing_date, "; //sql += " r.payment_date, "; //sql += " r.opening_bal, "; //sql += " r.total_debit, "; //sql += " r.bal_payment, "; //sql += " r.closing_bal, "; //sql += " r.min_due, "; //sql += " r.transaction_date, "; //sql += " r.value_date, "; //sql += " r.arn, "; //sql += " r.details, "; //sql += " r.billing_amount_du_co, "; //sql += " r.billing_amount_du_no, "; //sql += " r.address, "; //sql += " r.PHONE_HOME, "; //sql += " r.PHONE_MOBILE, "; //sql += " r.cr_account_nbr cr_account_nbr, "; //sql += " r.transaction_amount, "; //sql += " r.transaction_currency, "; //sql += " r.billing_currency, "; //sql += " r.machinhsachtd, "; //sql += " (select date_open "; //sql += " from " + Businessbp.executedb.owner + "acnt_contract "; //sql += " where contract_number = r.cr_account_nbr) date_create "; //sql += " from (select substr(a.card_number, 1, 4) || 'xxxxxxxx' || "; //sql += " substr(a.card_number, 13, 4) card_number, "; //sql += " a.embossed_name, "; //sql += " a.credit_limit, "; //sql += " to_char(a.stat_date, 'dd/mm/yyyy') as processing_date, "; //sql += " to_char(a.payment_date, 'dd/mm/yyyy') as payment_date, "; //sql += " a.opening_bal, "; //sql += " a.total_debit, "; //sql += " a.bal_payment, "; //sql += " a.closing_bal, "; //sql += " a.min_due, "; //sql += " to_char(a.transaction_date, 'dd/mm/yyyy') as transaction_date, "; //sql += " to_char(a.value_date, 'dd/mm/yyyy') as value_date, "; //sql += " a.arn, "; //sql += " a.details, "; //sql += " decode(a.transaction_sign, "; //sql += " '0', "; //sql += " to_number(''), "; //sql += " '1', "; //sql += " a.billing_amount, "; //sql += " a.billing_amount) billing_amount_du_co, "; //sql += " decode(a.transaction_sign, "; //sql += " '0', "; //sql += " a.billing_amount, "; //sql += " '1', "; //sql += " to_number(''), "; //sql += " a.billing_amount) billing_amount_du_no, "; //sql += " (a.MAILING_ADDRESS1 || ' ' || a.MAILING_ADDRESS2 || ' ' || "; //sql += " a.MAILING_ADDRESS3 || ' ' || a.MAILING_ADDRESS4) address, "; //sql += " a.PHONE_HOME, "; //sql += " a.PHONE_MOBILE, "; //sql += " a.cr_account_nbr cr_account_nbr, "; //sql += " a.transaction_amount, "; //sql += " (select b.name "; //sql += " from " + Businessbp.executedb.owner + "currency b "; //sql += " where trim(b.code) = trim(a.transaction_currency)"; //sql += " and b.amnd_state = 'A') transaction_currency, "; //sql += " (select b.name "; //sql += " from " + Businessbp.executedb.owner + "currency b "; //sql += " where trim(b.code) = trim(a.billing_currency)"; //sql += " and b.amnd_state = 'A') billing_currency, "; //sql += " c.machinhsachtd "; //sql += " from nab_billing_credit_log a, "; //sql += " " + Businessbp.executedb.owner + "acnt_contract crd, "; //sql += " nab_cp_card c "; //sql += " where trunc(a.stat_date) = "; //sql += " trunc(to_date('" + dtpckDate.Text.Trim ( ) + "', "; //sql += " 'dd/mm/yyyy')) "; //sql += " and a.card_number = crd.contract_number "; //sql += " and crd.add_info_01 = c.source_application_no "; //sql += " and crd.amnd_state = 'A' "; //sql += " and crd.con_cat = 'C' "; //sql += " UNION ALL"; //sql += " select a.card_number,"; //sql += " c.client_code,"; //sql += " a.embossed_name,"; //sql += " a.credit_limit,"; //sql += " to_char(a.stat_date, 'dd/mm/yyyy') as processing_date,"; //sql += " to_char(a.payment_date, 'dd/mm/yyyy') as payment_date,"; //sql += " a.opening_bal,"; //sql += " a.total_debit,"; //sql += " a.bal_payment,"; //sql += " a.closing_bal,"; //sql += " a.min_due,"; //sql += " to_char(a.transaction_date, 'dd/mm/yyyy') as transaction_date,"; //sql += " to_char(a.value_date, 'dd/mm/yyyy') as value_date,"; //sql += " a.arn,"; //sql += " a.details,"; //sql += " a.billing_amount billing_amount_du_co,"; //sql += " a.billing_amount billing_amount_du_no,"; //sql += " (a.MAILING_ADDRESS1 || ' ' || a.MAILING_ADDRESS2 || ' ' ||"; //sql += " a.MAILING_ADDRESS3 || ' ' || a.MAILING_ADDRESS4) address,"; //sql += " a.PHONE_HOME,"; //sql += " a.PHONE_MOBILE,"; //sql += " a.cr_account_nbr,"; //sql += " a.transaction_amount transaction_amount,"; //sql += " (select b.currency_code_alpha"; //sql += " from " + Businessbp.executedb.owner + "currency_table b"; //sql += " where trim(b.currency_code) ="; //sql += " trim(a.transaction_currency)) transaction_currency,"; //sql += " (select b.currency_code_alpha"; //sql += " from " + Businessbp.executedb.owner + "currency_table b"; //sql += " where trim(b.currency_code) ="; //sql += " trim(a.billing_currency)) billing_currency,"; //sql += " c.machinhsachtd"; //sql += " from nab_billing_credit_log a,"; //sql += " " + Businessbp.executedb.owner + "application app,"; //sql += " " + Businessbp.executedb.owner + "cp_card c"; //sql += " where 1 = 1"; //sql += " and a.cr_account_nbr = app.card_number"; //sql += " and app.application_no = c.source_application_no"; //sql += " and trunc(a.stat_date) ="; //sql += " trunc(to_date('" + dtpckDate.Text.Trim ( ) + "', 'dd/mm/yyyy'))"; //sql += " and trim(a.transaction_code) is null"; //sql += " ) r"; //sql += " where 1 = 1"; //sql += " order by r.client_code,"; //sql += " r.card_number asc,"; //sql += " to_date(r.transaction_date, 'dd/mm/yyyy') desc) A"; //sql += " where 1 = 1"; //2015-05-27 (10) //sql += " order by A.client_code asc, A.cr_account_nbr asc, A.card_number asc, to_date(A.transaction_date, 'dd/mm/yyyy') desc "; //2015-05-27 (10) //2015-06-23 (11) #endregion 2015-05-20 (9) } else { #region 03-04-2016 sql += "select (case when l.card_number = l.cr_account_nbr then l.card_number else (substr(l.card_number, 1, 4) || ' ' || substr(l.card_number, 5, 2) || "; sql += " 'xx xxxx ' || substr(l.card_number, 13, 4)) end) card_number, "; sql += " l.cr_account_nbr cr_account_nbr, "; sql += " l.embossed_name, "; sql += " l.phone_mobile, "; sql += " nvl(l.credit_limit, 0) credit_limit_acc, "; sql += " nvl(l.credit_limit_client, 0) credit_limit_client, "; sql += " nvl(l.avail_amount_acc, 0) avail_amount_acc, "; sql += " nvl(l.avail_amount_client, 0) avail_amount_client, "; sql += " to_char(l.stat_date, 'dd/mm/yyyy') as stat_date, "; sql += " to_char(l.payment_date, 'dd/mm/yyyy') as payment_date, "; sql += " nvl(l.opening_bal, 0) opening_bal, "; sql += " nvl(l.total_debit, 0) total_debit, "; sql += " (nvl(l.fee, 0) + nvl(l.interest, 0)) fee_and_interest, "; sql += " nvl(l.bal_payment, 0) bal_payment, "; sql += " nvl(l.closing_bal, 0) closing_bal, "; sql += " (trim(l.MAILING_ADDRESS1) || ' ' || trim(l.MAILING_ADDRESS2) || ' ' || "; sql += " trim(l.MAILING_ADDRESS3) || ' ' || trim(l.MAILING_ADDRESS4)) address, "; sql += " to_char(l.transaction_date, 'dd/mm/yyyy') as transaction_date, "; sql += " to_char(l.value_date, 'dd/mm/yyyy') as value_date, "; sql += " l.arn, "; sql += " nvl(l.transaction_amount, 0) transaction_amount, "; sql += " (select b.name "; sql += " from " + Businessbp.executedb.owner + "currency b "; sql += " where trim(b.code) = trim(l.transaction_currency)"; sql += " and b.amnd_state = 'A') transaction_currency, "; sql += " nvl(l.billing_amount, 0) billing_amount, "; sql += " decode((l.transaction_sign), "; sql += " '0', "; sql += " '(DR)', "; sql += " '1', "; sql += " '(CR)', "; sql += " '') transaction_sign, "; sql += " l.details, "; sql += " (case "; sql += " when not exists (select 1 "; sql += " from nab_credit_unpaid un "; sql += " where 1 = 1 "; sql += " and un.cr_account_nbr = l.cr_account_nbr "; sql += " and substr(un.nqh_code, 1, 1) = 'O') then "; sql += " nvl(l.min_due, 0) "; sql += " else "; sql += " nvl(l.closing_bal, 0) "; sql += " end) min_due, "; sql += " nvl(l.min_due_install, 0) min_due_install, "; sql += " nvl(l.min_due_crterm, 0) min_due_crterm, "; sql += " nvl(l.cash_back_amount, 0) cash_back_amount, "; sql += " nvl(l.diamondbay_amount, 0) diamondbay_amount, "; sql += " nvl(l.diamondbay_rank, 0) diamondbay_rank, "; sql += " nvl(l.loyalty_score_earned, 0) loyalty_score_earned, "; sql += " nvl(l.loyalty_score_spent, 0) loyalty_score_spent, "; sql += " nvl(l.loyalty_cash_exchanged, 0) loyalty_cash_exchanged, "; sql += " nvl(l.loyalty_score_avail, 0) loyalty_score_avail, "; sql += " nvl(l.ovd_flag,'N') ovd_flag"; sql += " from nab_billing_credit_log l "; sql += " where 1 = 1 "; sql += " and l.stat_date = trunc(to_date('" + dtpckDate.Text.Trim ( ) + "', 'dd/mm/yyyy')) "; sql += " and (l.total_debit + l.fee + l.bal_payment + abs(l.closing_bal)) <> 0 "; sql += " and trim(l.cr_account_nbr) = '" + cr_account_nbr.Trim ( ) + "' "; sql += " order by l.cr_account_nbr asc, "; sql += " to_date(l.transaction_date, 'dd/mm/yyyy') desc, "; sql += " to_date(l.value_date, 'dd/mm/yyyy') desc "; #endregion 2015-09-08 (12) } dt_bill.Clear ( ); dt_bill = Businessbp.executedb.getTable ( sql, ref err ); if (err != "") { MessageBox.Show ( err ); this.Cursor = Cursors.Default; return; } else { //string file_path = tbFilePath.Text.Trim() + "\\" + card_number.Trim() + ".pdf"; string file_path = tbFilePath.Text.Trim ( ) + "\\" + cr_account_nbr.Trim ( ) + ".pdf"; //Export pdf try { if (dt_bill.Rows.Count > 0) { if (DateTime.ParseExact ( dtpckDate.Text.Trim ( ), "dd/MM/yyyy", CultureInfo.InvariantCulture ) < DateTime.ParseExact ( "24/09/2015", "dd/MM/yyyy", CultureInfo.InvariantCulture )) // 2015-09-08 (12) { Rpt_Credit_Billing_new_2 cry = new Rpt_Credit_Billing_new_2 ( ); //2015-03-19 (8) new cry.SetDataSource ( dt_bill ); string title = ""; string title2 = ""; string title3 = ""; title = "BẢNG THÔNG BÁO GIAO DỊCH"; title2 = "(Từ ngày " + dtpckDate.Value.AddMonths ( -1 ).ToString ( "dd/MM/yyyy" ).Trim ( ) + " đến ngày " + dtpckDate.Text.Trim ( ) + " )"; cry.SetParameterValue ( "title", title ); cry.SetParameterValue ( "title2", title2 ); title3 = Get_title3 ( id ); if (title3.Trim ( ) != "") cry.SetParameterValue ( "title3", title3 ); else { MessageBox.Show ( "Err when get title3" ); return; } // a.title3 = "Yêu cầu thanh toán trước 10h ngày:"; ExportOptions CrExportOptions; DiskFileDestinationOptions CrDiskFileDestinationOptions = new DiskFileDestinationOptions ( ); PdfRtfWordFormatOptions CrFormatTypeOptions = new PdfRtfWordFormatOptions ( ); CrDiskFileDestinationOptions.DiskFileName = file_path;// tbFilePath.Text.Trim() + "\\" + card_number.Trim() + ".pdf";//"c:\\csharp.net-informations.pdf"; CrExportOptions = cry.ExportOptions; { CrExportOptions.ExportDestinationType = ExportDestinationType.DiskFile; CrExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat; CrExportOptions.DestinationOptions = CrDiskFileDestinationOptions; CrExportOptions.FormatOptions = CrFormatTypeOptions; } cry.Export ( ); //--Fix for Load Report failse if (cry != null) { cry.Close ( ); cry.Dispose ( ); } } #region 2015-09-08 (12) else { Rpt_Credit_Billing_new_3 cry = new Rpt_Credit_Billing_new_3 ( ); cry.SetDataSource ( dt_bill ); ExportOptions CrExportOptions; DiskFileDestinationOptions CrDiskFileDestinationOptions = new DiskFileDestinationOptions ( ); PdfRtfWordFormatOptions CrFormatTypeOptions = new PdfRtfWordFormatOptions ( ); CrDiskFileDestinationOptions.DiskFileName = file_path;// tbFilePath.Text.Trim() + "\\" + card_number.Trim() + ".pdf";//"c:\\csharp.net-informations.pdf"; CrExportOptions = cry.ExportOptions; { CrExportOptions.ExportDestinationType = ExportDestinationType.DiskFile; CrExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat; CrExportOptions.DestinationOptions = CrDiskFileDestinationOptions; CrExportOptions.FormatOptions = CrFormatTypeOptions; } cry.Export ( ); //--Fix for Load Report failse if (cry != null) { cry.Close ( ); cry.Dispose ( ); } } #endregion 2015-09-08 (12) #region 2016-06-16 (16) sql = ""; err = ""; sql += " select ca.e_mail EMAIL "; sql += " from " + Businessbp.executedb.owner + "contract_addresses ca "; sql += " where ca.acnt_contract__oid = '" + dt_card_process.Rows[i]["id"].ToString ( ) + "' "; sql += " and ca.address_type__id = '1' "; sql += " union all "; sql += " select ca.email_id EMAIL "; sql += " from nab_corporate_card ca "; sql += " where ca.cr_account_number_corporate = '" + dt_card_process.Rows[i]["cr_account_nbr"].ToString ( ) + "' "; sql += " and ca.email_id is not null "; sql += " and nvl(ca.active_flag,'0') = '1'"; #endregion 2016-06-16 (16) DataTable dtInsert = Businessbp.executedb.getTable ( sql, ref err ); if (err != "") { MessageBox.Show ( err ); // return; } else { if (dtInsert.Rows.Count > 0) { string DATE_START = dt_card_process.Rows[0]["DATE_START"].ToString ( ); string EMAIL = dtInsert.Rows[0]["EMAIL"].ToString ( ).Trim ( ); string BILL_DATE = dt_card_process.Rows[0]["BILL_DATE"].ToString ( ); // sql = ""; err = ""; if (EMAIL.Trim ( ) == "") { } else { if (dtInsert.Rows.Count == 1) { sql = "insert into NAB_CREDIT_SENDMAIL(DATE_START ,CARD_NUMBER ,FILE_NAME ,EMAIL,BILL_DATE ,SEND_FLAG, USER_CREATE , DATE_CREATE)"; sql += "values ("; sql += "" + ( DATE_START.Trim ( ) == "" ? "null" : ( "to_date('" + DATE_START + "','dd/MM/yyyy')" ) ) + ","; //sql += "'" + card_number + "',"; sql += "'" + cr_account_nbr + "',"; sql += "'" + file_path + "',"; sql += "" + ( EMAIL.Trim ( ) == "" ? "null" : ( "'" + EMAIL + "'" ) ) + ","; sql += "" + ( BILL_DATE == "" ? "null" : ( "to_date('" + BILL_DATE + "','dd/mm/yyyy')" ) ) + ","; sql += "'0',"; sql += "'" + Businessbp.executedb.Usrid + "',"; sql += "sysdate"; sql += ")"; Businessbp.executedb.ExecuteDML ( sql, ref err ); if (err != "") { MessageBox.Show ( err ); //return; } } else //2016-06-16 (16) { string EMAILCOR = dtInsert.Rows[1]["EMAIL"].ToString ( ).Trim ( ); if (EMAILCOR.Trim ( ) != "") { sql = " begin "; sql += " insert into NAB_CREDIT_SENDMAIL(DATE_START ,CARD_NUMBER ,FILE_NAME ,EMAIL,BILL_DATE ,SEND_FLAG, USER_CREATE , DATE_CREATE)"; sql += " values ("; sql += "" + ( DATE_START.Trim ( ) == "" ? "null" : ( "to_date('" + DATE_START + "','dd/MM/yyyy')" ) ) + ","; //sql += "'" + card_number + "',"; sql += "'" + cr_account_nbr + "',"; sql += "'" + file_path + "',"; sql += "" + ( EMAILCOR.Trim ( ) == "" ? "null" : ( "'" + EMAILCOR.Trim ( ) + "'" ) ) + ","; sql += "" + ( BILL_DATE == "" ? "null" : ( "to_date('" + BILL_DATE + "','dd/mm/yyyy')" ) ) + ","; sql += "'0',"; sql += "'" + Businessbp.executedb.Usrid + "',"; sql += "sysdate"; sql += ");"; sql += " insert into NAB_CREDIT_SENDMAIL(DATE_START ,CARD_NUMBER ,FILE_NAME ,EMAIL,BILL_DATE ,SEND_FLAG, USER_CREATE , DATE_CREATE)"; sql += " values ("; sql += "" + ( DATE_START.Trim ( ) == "" ? "null" : ( "to_date('" + DATE_START + "','dd/MM/yyyy')" ) ) + ","; //sql += "'" + card_number + "',"; sql += "'" + cr_account_nbr + "',"; sql += "'" + file_path + "',"; sql += "" + ( EMAIL.Trim ( ) == "" ? "null" : ( "'" + EMAIL + "'" ) ) + ","; sql += "" + ( BILL_DATE == "" ? "null" : ( "to_date('" + BILL_DATE + "','dd/mm/yyyy')" ) ) + ","; sql += "'0',"; sql += "'" + Businessbp.executedb.Usrid + "',"; sql += "sysdate"; sql += ");"; //sql += " insert into " + Businessbp.executedb.owner + "NAB_CREDIT_SENDMAIL(DATE_START ,CARD_NUMBER ,FILE_NAME ,EMAIL,BILL_DATE ,SEND_FLAG, USER_CREATE , DATE_CREATE)"; //sql += " values ("; //sql += "" + ( DATE_START.Trim ( ) == "" ? "null" : ( "to_date('" + DATE_START + "','dd/MM/yyyy')" ) ) + ","; ////sql += "'" + card_number + "',"; //sql += "'" + cr_account_nbr + "',"; //sql += "'" + file_path + "',"; //sql += " '*****@*****.**',"; //sql += "" + ( BILL_DATE == "" ? "null" : ( "to_date('" + BILL_DATE + "','dd/mm/yyyy')" ) ) + ","; //sql += "'0',"; //sql += "'" + Businessbp.executedb.Usrid + "',"; //sql += "sysdate"; //sql += ");"; sql += " commit;"; sql += " exception"; sql += " when others then"; sql += " rollback;"; sql += " end;"; Businessbp.executedb.ExecuteDML ( sql, ref err ); if (err != "") { MessageBox.Show ( err ); //return; } } } } } else//Nếu không có dữ liệu { } } } else { } } catch (Exception ex) { MessageBox.Show ( ex.Message ); } } } } } tbStatus.Text = "Successful!!!"; this.Cursor = Cursors.Default; } } } catch (Exception ex) { MessageBox.Show ( ex.ToString ( ) ); } } } } }
public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { Rpt_Credit_Billing_new_2 rpt = new Rpt_Credit_Billing_new_2(); rpt.Site = this.Site; return rpt; }