Exemplo n.º 1
0
    protected void print_offerletter(object sender, EventArgs e)
    {
        {
            try
            {
                if (TXTNOKP.Text != "")
                {
                    System.Web.UI.WebControls.Button button = (System.Web.UI.WebControls.Button)sender;
                    string    buttonId  = button.ID;
                    DataTable app_rujno = new DataTable();
                    app_rujno = DBCon.Ora_Execute_table("select cmn_applcn_no from cmn_ref_no where cmn_applcn_no= '" + TXTNOKP.Text + "' and cmn_ref_no='" + no_rujukan.Text + "'");
                    DataTable app_icno = new DataTable();
                    app_icno = DBCon.Ora_Execute_table("select app_new_icno from jpa_application where app_applcn_no= '" + TXTNOKP.Text + "'");
                    string sqno = string.Empty;
                    if (buttonId == "Button5")
                    {
                        sqno = "1";
                    }
                    else if (buttonId == "Button6")
                    {
                        sqno = "2";
                    }
                    else
                    {
                        sqno = "3";
                    }
                    if (app_rujno.Rows.Count != 0)
                    {
                        //Path
                        DataSet   ds = new DataSet();
                        DataTable dt = new DataTable();
                        //if (buttonId == "Button5" || buttonId == "Button6" || buttonId == "Button7")
                        //{

                        //    dt = DBCon.Ora_Execute_table("select * from (select * from jpa_guarantor where gua_applcn_no='" + TXTNOKP.Text + "' and gua_seq_no='" + sqno + "') as a full outer join(select * from cmn_ref_no where cmn_applcn_no='" + TXTNOKP.Text + "' and cmn_crt_dt IN (SELECT max(cmn_crt_dt) FROM cmn_ref_no)) as b on b.cmn_applcn_no=a.gua_applcn_no full outer join(select * from jpa_application where app_applcn_no='" + TXTNOKP.Text + "') as c on c.app_applcn_no=b.cmn_applcn_no");
                        //}
                        //else
                        //{
                        dt = DBCon.Ora_Execute_table("select *,mm.mem_member_no,app_new_icno,FORMAT (GETDATE(), 'dd/MM/yyyy', 'en-US') as cdt,FORMAT (jkk.jkk_meeting_dt, 'dd/MM/yyyy', 'en-US') as jkk_mdt,ISNULL(db.pha_pay_amt,'0.00') as jb_amt,ISNULL(app_loan_amt,'')+ISNULL(app_cumm_profit_amt,'') as lon_prfit_tot from (select * from cmn_ref_no where cmn_crt_dt IN (SELECT max(cmn_crt_dt) FROM cmn_ref_no) and cmn_applcn_no='" + TXTNOKP.Text + "') as a full outer join (select * from jpa_application where app_applcn_no='" + TXTNOKP.Text + "') as b on b.app_applcn_no=a.cmn_applcn_no full outer join (select cal_applcn_no,isnull(cal_approve_amt,0)cal_approve_amt,isnull(cal_installment_amt,0)cal_installment_amt,isnull(cal_profit_amt,0)cal_profit_amt,isnull(cal_stamp_duty_amt,0)cal_stamp_duty_amt,isnull(cal_process_fee,0)cal_process_fee,isnull(cal_deposit_amt,0)cal_deposit_amt,isnull(cal_tkh_amt,0)cal_tkh_amt,(isnull(cal_approve_amt,0) + isnull(cal_profit_amt,0)) as ap_amt,isnull(cal_profit_rate,0)cal_profit_rate from jpa_calculate_fee where cal_applcn_no='" + TXTNOKP.Text + "') as c on c.cal_applcn_no=b.app_applcn_no left join jpa_jkkpa_approval jkk on jkk.jkk_applcn_no=b.app_applcn_no left join jpa_disburse db on db.pha_applcn_no=b.app_applcn_no left join mem_member mm on mm.mem_new_icno=b.app_new_icno");
                        //}

                        Rptviwer_cetak.Reset();
                        ds.Tables.Add(dt);

                        Rptviwer_cetak.LocalReport.DataSources.Clear();
                        ReportDataSource rds;
                        DataTable        mem_status = new DataTable();
                        mem_status = DBCon.Ora_Execute_table("select app_loan_type_cd from jpa_application where app_applcn_no='" + TXTNOKP.Text + "'");
                        if (mem_status.Rows.Count != 0)
                        {
                            if (mem_status.Rows[0]["app_loan_type_cd"].ToString() == "P")
                            {
                                if (buttonId == "Button3")
                                {
                                    Rptviwer_cetak.LocalReport.ReportPath = "Pelaburan_Anggota/cetak_offer_sahabat.rdlc";
                                    rds = new ReportDataSource("coffer", dt);
                                }
                                //else if (buttonId == "Button4")
                                //{
                                //    Rptviwer_cetak.LocalReport.ReportPath = "Pelaburan_Anggota/Kemudahan_staff.rdlc";
                                //    rds = new ReportDataSource("kemudahan", dt);
                                //}
                                //else if (buttonId == "Button8")
                                //{
                                //    Rptviwer_cetak.LocalReport.ReportPath = "Pelaburan_Anggota/Tambahan.rdlc";
                                //    rds = new ReportDataSource("tambahan", dt);
                                //}
                                else if (buttonId == "Button4")
                                {
                                    Rptviwer_cetak.LocalReport.ReportPath = "Pelaburan_Anggota/Penjamin.rdlc";
                                    rds = new ReportDataSource("penjamin", dt);
                                }
                                else
                                {
                                    Rptviwer_cetak.LocalReport.ReportPath = "";
                                    rds = new ReportDataSource("coffer", dt);
                                }
                            }
                            else
                            {
                                if (buttonId == "Button3")
                                {
                                    Rptviwer_cetak.LocalReport.ReportPath = "Pelaburan_Anggota/cetak_offer_sahabat.rdlc";
                                    rds = new ReportDataSource("coffer", dt);
                                }
                                //else if (buttonId == "Button4")
                                //{
                                //    Rptviwer_cetak.LocalReport.ReportPath = "Pelaburan_Anggota/Kemudahan_sahabat.rdlc";
                                //    rds = new ReportDataSource("kemudahan", dt);
                                //}
                                //else if (buttonId == "Button8")
                                //{
                                //    Rptviwer_cetak.LocalReport.ReportPath = "Pelaburan_Anggota/Tambahan.rdlc";
                                //    rds = new ReportDataSource("tambahan", dt);
                                //}
                                else if (buttonId == "Button4")
                                {
                                    Rptviwer_cetak.LocalReport.ReportPath = "Pelaburan_Anggota/Penjamin.rdlc";
                                    rds = new ReportDataSource("penjamin", dt);
                                }
                                else
                                {
                                    Rptviwer_cetak.LocalReport.ReportPath = "";
                                    rds = new ReportDataSource("coffer", dt);
                                }
                            }
                        }
                        else
                        {
                            Rptviwer_cetak.LocalReport.ReportPath = "";
                            rds = new ReportDataSource("coffer", dt);
                        }
                        //Parameters
                        //   if (buttonId == "Button4")
                        //   {

                        //       decimal a10 = decimal.Parse(dt.Rows[0][40].ToString());
                        //       string ldu = DecimalToWords(a10);

                        //       decimal a4 = (decimal)dt.Rows[0]["cal_approve_amt"];
                        //       string cpa = DecimalToWords(a4);

                        //       decimal a5 = (decimal)dt.Rows[0]["cal_installment_amt"];
                        //       string cima = DecimalToWords(a5);

                        //       decimal a6 = (decimal)dt.Rows[0]["cal_profit_amt"];
                        //       string cpat = DecimalToWords(a6);

                        //       decimal a7 = (decimal)dt.Rows[0]["ap_amt"];
                        //       string apa = DecimalToWords(a7);

                        //       decimal a8 = (decimal)dt.Rows[0]["cal_profit_rate"];
                        //       string cpr = DecimalToWords(a8);

                        //       decimal a9 = (decimal)dt.Rows[0]["lon_prfit_tot"];
                        //       string lpt = DecimalToWords(a9);



                        //       ReportParameter[] rptParams = new ReportParameter[]{

                        //new ReportParameter("amt",  cpa ),
                        //new ReportParameter("amt1",  cima ),
                        //new ReportParameter("amt2",  cpat ),
                        //new ReportParameter("amt3",  apa ),
                        //new ReportParameter("amt4",  cpr ),
                        // new ReportParameter("amt5",  lpt ),
                        //new ReportParameter("amt6",  ldu )

                        //};


                        //       Rptviwer_cetak.LocalReport.SetParameters(rptParams);
                        //   }
                        Rptviwer_cetak.LocalReport.DataSources.Add(rds);

                        //Refresh
                        Rptviwer_cetak.LocalReport.Refresh();
                        Warning[] warnings;

                        string[] streamids;

                        string mimeType;

                        string encoding;

                        string extension;

                        string fname = DateTime.Now.ToString("dd_MM_yyyy");

                        string devinfo = "<DeviceInfo><ColorDepth>32</ColorDepth><DpiX>350</DpiX><DpiY>350</DpiY><OutputFormat>PDF</OutputFormat>" +
                                         "  <PageWidth>12.20in</PageWidth>" +
                                         "  <PageHeight>8.27in</PageHeight>" +
                                         "  <MarginTop>0.1in</MarginTop>" +
                                         "  <MarginLeft>0.5in</MarginLeft>" +
                                         "  <MarginRight>0in</MarginRight>" +
                                         "  <MarginBottom>0in</MarginBottom>" +
                                         "</DeviceInfo>";

                        byte[] bytes = Rptviwer_cetak.LocalReport.Render("PDF", null, out mimeType, out encoding, out extension, out streamids, out warnings);


                        Response.Buffer = true;

                        Response.Clear();

                        Response.ClearHeaders();

                        Response.ClearContent();

                        Response.ContentType = "application/pdf";

                        if (buttonId == "Button3")
                        {
                            Response.AddHeader("content-disposition", "attachment; filename=Surat_Tawaran_" + TXTNOKP.Text + "." + extension);
                        }
                        //else if (buttonId == "Button8")
                        //{
                        //    Response.AddHeader("content-disposition", "attachment; filename=Perjanjian_Tambahan_" + TXTNOKP.Text + "." + extension);
                        //}
                        else if (buttonId == "Button4")
                        {
                            Response.AddHeader("content-disposition", "attachment; filename=Kemudahan_Perjanjian_" + TXTNOKP.Text + "." + extension);
                        }
                        else
                        {
                            Response.AddHeader("content-disposition", "attachment; filename=Kemudahan_Perjanjian_" + TXTNOKP.Text + "." + extension);
                        }

                        Response.BinaryWrite(bytes);

                        //Response.Write("<script>");
                        //Response.Write("window.open('', '_newtab');");
                        //Response.Write("</script>");
                        Response.Flush();

                        Response.End();
                    }

                    else
                    {
                        tab1();
                        ScriptManager.RegisterStartupScript(this, GetType(), "alertMessage", "$.Zebra_Dialog('Sila Masukkan No Rujukan',{'type': 'warning','title': 'Warning','auto_close': 2000});", true);
                    }
                }
                else
                {
                    tab1();
                    ScriptManager.RegisterStartupScript(this, GetType(), "alertMessage", "$.Zebra_Dialog('Medan Input Adalah Mandatori',{'type': 'warning','title': 'Warning','auto_close': 2000});", true);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
    }
Exemplo n.º 2
0
    protected void Button1_Click1(object sender, EventArgs e)
    {
        try
        {
            if (Applcn_no.Text != "")
            {
                string    xxx_tname = string.Empty, xxx_fname = string.Empty;
                DataTable ddt_jbb_ind = new DataTable();
                ddt_jbb_ind = DBCon.Ora_Execute_table("select app_current_jbb_ind from jpa_application where app_applcn_no='" + Applcn_no.Text + "'");

                if (ddt_jbb_ind.Rows.Count != 0)
                {
                    string jbbind = ddt_jbb_ind.Rows[0]["app_current_jbb_ind"].ToString();
                    if (jbbind == "P")
                    {
                        xxx_tname = "pjs";
                        xxx_fname = "pjs";
                    }
                    else if (jbbind == "H")
                    {
                        xxx_tname = "holiday";
                        xxx_fname = "hol";
                    }
                    else if (jbbind == "E")
                    {
                        xxx_tname = "extension";
                        xxx_fname = "ext";
                    }
                    else if (jbbind == "L")
                    {
                        xxx_tname = "writeoff";
                        xxx_fname = "jwo";
                    }
                    else
                    {
                        xxx_tname = "normal";
                        xxx_fname = "jno";
                    }
                }
                //Path
                DataSet   ds = new DataSet();
                DataTable dt = new DataTable();
                //dt = DBCon.Ora_Execute_table("select app_name,app_mailing_address,app_mailing_postcode,ISNULL(KA.Area_Name, '') AS Area_Name,app_end_pay_dt,RJP.Description from jpa_application JA Left Join jpa_jkkpa_approval as JJA ON JJA.jkk_applcn_no=JA.app_applcn_no Left Join Ref_Wilayah as RW ON RW.Wilayah_Code=JA.app_region_cd Left join ref_branch AS RB ON RB.branch_cd=JA.app_branch_cd left join Ref_Kawasan as KA ON KA.Area_Code=JA.app_mailing_state_cd left join Ref_Jenis_Pelaburan as RJP ON RJP.Description_Code=JA.app_loan_type_cd where JA.app_applcn_no='" + Applcn_no.Text + "' and JJA.jkk_result_ind='L'");
                dt = DBCon.Ora_Execute_table("select * from (select app_new_icno,app_name,app_applcn_no,ISNULL(app_mailing_address,'') app_mailing_address,app_mailing_postcode,ISNULL(KA.Area_Name, '') AS Area_Name,app_end_pay_dt,RJP.Description,jg.gua_name from jpa_application JA Left join jpa_guarantor as jg on jg.gua_applcn_no=ja.app_applcn_no Left Join jpa_jkkpa_approval as JJA ON JJA.jkk_applcn_no=JA.app_applcn_no Left Join Ref_Wilayah as RW ON RW.Wilayah_Code=JA.app_region_cd Left join ref_branch AS RB ON RB.branch_cd=JA.app_branch_cd left join Ref_Kawasan as KA ON KA.Area_Code=JA.app_mailing_state_cd left join Ref_Jenis_Pelaburan as RJP ON RJP.Description_Code=JA.app_loan_type_cd where JA.app_applcn_no='" + Applcn_no.Text + "' and JJA.jkk_result_ind='L') as a full outer join (select cmn_applcn_no,cmn_ref_no from cmn_ref_no where cmn_applcn_no='" + Applcn_no.Text + "' and cmn_crt_dt IN (SELECT max(cmn_crt_dt) FROM cmn_ref_no where cmn_applcn_no='" + Applcn_no.Text + "')) as b on b.cmn_applcn_no='" + Applcn_no.Text + "'");
                Rptviwer_cetak.Reset();
                ds.Tables.Add(dt);

                DataTable jbb_lpdt = new DataTable();
                jbb_lpdt = DBCon.Ora_Execute_table("select FORMAT(" + xxx_fname + "_pay_date,'dd/MM/yyyy', 'en-us') as pdt from jpa_jbb_" + xxx_tname + " where " + xxx_fname + "_applcn_no='" + Applcn_no.Text + "' and " + xxx_fname + "_actual_pay_date != '1900-01-01' and " + xxx_fname + "_upd_dt =  (select top (1) " + xxx_fname + "_upd_dt from jpa_jbb_" + xxx_tname + " where " + xxx_fname + "_applcn_no='" + Applcn_no.Text + "' and " + xxx_fname + "_actual_pay_date != '1900-01-01' order by " + xxx_fname + "_pay_date DESC)");

                Rptviwer_cetak.LocalReport.DataSources.Clear();
                if (jbb_lpdt.Rows.Count != 0)
                {
                    Rptviwer_cetak.LocalReport.ReportPath = "PELABURAN_ANGGOTA/PP_Tunggakan.rdlc";
                    ReportDataSource  rds       = new ReportDataSource("PP_CSPT", dt);
                    ReportParameter[] rptParams = new ReportParameter[] {
                        new ReportParameter("lpdt", jbb_lpdt.Rows[0]["pdt"].ToString())
                    };


                    Rptviwer_cetak.LocalReport.SetParameters(rptParams);
                    Rptviwer_cetak.LocalReport.DataSources.Add(rds);

                    //Refresh
                    Rptviwer_cetak.LocalReport.Refresh();
                    Warning[] warnings;

                    string[] streamids;

                    string mimeType;

                    string encoding;

                    string extension;

                    string fname = DateTime.Now.ToString("dd_MM_yyyy");

                    string devinfo;
                    devinfo = "<DeviceInfo>" +
                              "<OutputFormat>EMF</OutputFormat>" +
                              "<PageWidth>8.5in</PageWidth>" +
                              "<PageHeight>11in</PageHeight>" +
                              "<MarginTop>0.25in</MarginTop>" +
                              "<MarginLeft>0.25in</MarginLeft>" +
                              "<MarginRight>0.25in</MarginRight>" +
                              "<MarginBottom>0.25in</MarginBottom>" +
                              "</DeviceInfo>";

                    byte[] bytes = Rptviwer_cetak.LocalReport.Render("PDF", devinfo, out mimeType, out encoding, out extension, out streamids, out warnings);
                    Response.Buffer = true;
                    Response.Clear();
                    Response.ClearHeaders();
                    Response.ClearContent();
                    Response.ContentType = "application/pdf";
                    Response.AddHeader("content-disposition", "attachment; filename=Pelepasan_Tunggakan_" + Applcn_no.Text + "." + extension);
                    Response.BinaryWrite(bytes);
                    //Response.Write("<script>");
                    //Response.Write("window.open('', '_newtab');");
                    //Response.Write("</script>");
                    Response.Flush();
                    Response.End();
                    //Response.Redirect(default.aspx, false);
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this, GetType(), "alertMessage", "$.Zebra_Dialog('Rekod Tidak Dijumpai.',{'type': 'warning','title': 'Warning','auto_close': 2000});", true);
                }
            }
            else
            {
                ScriptManager.RegisterStartupScript(this, GetType(), "alertMessage", "$.Zebra_Dialog('Medan Input Adalah Mandatori.',{'type': 'warning','title': 'Warning','auto_close': 2000});", true);
            }
        }
        catch (Exception ex)
        {
            throw ex;
            //Request.Redirect(url, false);
        }
    }