public void ddlPerformancesload(int engmntid)
 {
     if (ddlPerformance.SelectedIndex > -1)
     {
         string ddlval = ddlPerformance.SelectedItem.Value;
         dtperformancelist = new DataTable();
         ofcobj = new BoxOfficeData();
         DataTable ds = new DataTable();
         ds = ofcobj.LoadDiscountdata(Convert.ToInt32(hdn_engagementid.Value), Convert.ToInt32(ddlPerformance.SelectedItem.Value.ToString()));
         if (ds.Rows.Count > 0)
         {
             if (Convert.ToInt32(Convert.ToString(ds.Rows[0]["ScheduleCount"])) > 0)
             {
                 lbl_staticmsg.Text = "Please enter data for all Performances, otherwise the reports will display the incorrect values.";
             }
             else
             {
                 lbl_staticmsg.Text = string.Empty;
             }
             if (Convert.ToInt32(Convert.ToString(ds.Rows[0]["discount"])) > 0)
             {
                 pnlcolumn.Visible = false;
                 ddlPerformance.Visible = true;
                 txtPerformance.Visible = false;
             }
             else
             {
                 pnlcolumn.Visible = true;
                 ddlPerformance.Visible = false;
                 txtPerformance.Visible = false;
                 lblcopyfrom.Visible = false;
                 pnlCity.Visible = false;
             }
             filldatacalculations(ds);
             ucdocx.GetDocxDetails(Convert.ToInt32(ddlPerformance.SelectedItem.Value.ToString()), "Schedule");
             tdcopyfrom.Visible = true;
         }
         else
         {
             tdcopyfrom.Visible = false;
             pnlcolumn.Visible = true;
             ddlPerformance.Visible = false;
             txtPerformance.Visible = false;
             lblcopyfrom.Visible = false;
             pnlCity.Visible = false;
             LoadPerformanceCopy(Convert.ToInt32(hdn_engagementid.Value));
             showhidecopyfrom(false);
         }
     }
 }
 protected void ddlPerformance_SelectedIndexChanged(object sender, EventArgs e)
 {
     txtComps.Text = "";
     txtDropcount.Text = "";
     txtPaidAttendance.Text = "";
     txtgrossales.Text = "";
     DataTable ds = new DataTable();
     ofcobj = new BoxOfficeData();
     ds = ofcobj.Loadboxofficedata(Convert.ToInt32(hdn_engagementid.Value), Convert.ToInt32(ddlPerformance.SelectedItem.Value.ToString()));
     if (ds.Rows.Count > 0)
     {
         filldatacalculations(ds, "n");
     }
     else
     {
         LoadPerformanceCopy(Convert.ToInt32(hdn_engagementid.Value));
     }
 }
        public void ddlPerformancesload(int engmntid)
        {
            string ddlval = ddlPerformance.SelectedItem.Value;
            dtperformancelist = new DataTable();
            ofcobj = new BoxOfficeData();
            //dtperformancelist = ofcobj.GetPerformancelist(engmntid);
            dtperformancelist = ofcobj.LoadPerformancelist(engmntid);
            ViewState["dtperformance"] = dtperformancelist;
            ddlPerformance.DataSource = dtperformancelist;
            ddlPerformance.DataTextField = "schedule_type";
            ddlPerformance.DataValueField = "schedule_id";
            ddlPerformance.DataBind();
            chklstPerformance.DataSource = dtperformancelist;
            chklstPerformance.DataTextField = "schedule_type";
            chklstPerformance.DataValueField = "schedule_id";
            chklstPerformance.DataBind();
            ListItem lst = new ListItem();
            lst.Text = "All";
            lst.Value = "0";
            chklstPerformance.Items.Insert(0, lst);

            DataTable ds = new DataTable();
            ofcobj = new BoxOfficeData();
            ddlPerformance.SelectedIndex = ddlPerformance.Items.IndexOf(ddlPerformance.Items.FindByValue(ddlval));
            if (ddlPerformance.SelectedIndex == -1)
                ddlPerformance.SelectedIndex = 0;
            //ds = ofcobj.Loadboxofficedata(Convert.ToInt32(hdn_engagementid.Value), Convert.ToInt32(ddlPerformance.SelectedItem.Value.ToString()));
            ds = ofcobj.Loadboxofficedata(Convert.ToInt32(hdn_engagementid.Value), Convert.ToInt32(ddlPerformance.SelectedItem.Value.ToString()));
            if (ds.Rows.Count > 0)
            {
                if (Convert.ToInt32(Convert.ToString(ds.Rows[0]["BOCount"])) > 0)
                {
                    pnlcolumn.Visible = false;
                    ddlPerformance.Visible = true;
                    txtPerformance.Visible = false;

                }
                else
                {
                    tdcopyfrom.Visible = false;
                    pnlcolumn.Visible = true;
                    ddlPerformance.Visible = false;
                    txtPerformance.Visible = true;
                    lblcopyfrom.Visible = false;
                    pnlperf.Visible = false;
                }

                filldatacalculations(ds, "n");
                rewriteOverrideValues((Convert.ToInt32(Convert.ToString(ds.Rows[0]["BO_ID"]))));
            }
            else
            {
                tdcopyfrom.Visible = false;
                pnlcolumn.Visible = true;
                ddlPerformance.Visible = false;
                txtPerformance.Visible = true;
                lblcopyfrom.Visible = false;
                pnlperf.Visible = false;
                LoadPerformanceCopy(Convert.ToInt32(hdn_engagementid.Value));

            }
        }
        public void SaveData()
        {
            try
            {

                if (checkvalid() == false)
                {
                    txtPaidAttendance.Focus();
                    return;
                }
                bool expflg = false;
                if (hdninitial_paidattn.Value.AutoformatInt() != txtPaidAttendance.Text.AutoformatInt() || hdninitial_dropcount.Value.AutoformatInt() != txtDropcount.Text.AutoformatInt())
                {
                    expflg = true;
                }
                if (expflg == true)
                {
                    string alertmsg = "Expense insurance actual or ticket printing actual updated due to Attendance or Drop Count change. Please check";

                    ScriptManager.RegisterStartupScript(this, this.GetType(), "", "Subscriptioncalc();JQalertbox('" + alertmsg + "');", true);
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "", "Subscriptioncalc();", true);
                }

                //if (hidfval.Value.Length > 0)
                //{
                //    lbl_msg.Text = "Negative value not allowed";
                //    lbl_msg.ForeColor = System.Drawing.Color.Red;
                //    return;
                //}

                char[] chDlr = { '$', '%', ',', ' ' };
                EngagementMaster EngmtMaster = (EngagementMaster)Page.Master;

                if (hdn_engagementid.Value != "0" && hdn_engagementid.Value != "")
                {
                    if (hdn_schedulecount.Value != "0" && hdn_schedulecount.Value != "")
                    {
                        Nullable<decimal> bo_drop_count = null, bo_gross_sales = null, bo_facility_fee = null, bo_tax1 = null, bo_tax_amount_over = null,
                            bo_tax_facility_comm = null, bo_sub_gross_rcpt = null, bo_sub_comm_ptg = null, bo_ph_gross_rcpt = null, bo_ph_comm_ptg = null, bo_web_gross_rcpt = null,
                            bo_web_comm_ptg = null, bo_cc_gross_rcpt = null, bo_cc_comm_ptg = null, bo_outlet_gross_rcpt = null, bo_outlet_comm_ptg = null, bo_single_tix_gross_rcpt = null,
                            bo_single_tix_comm_ptg = null, bo_small_group_gross_rcpt = null, bo_small_group_comm_ptg = null, bo_large_group_gross_rcpt = null,
                            bo_large_group_comm_ptg = null, bo_other_per_gross_rcpt = null, bo_other_per_comm_ptg = null, bo_other_usd_gross_rcpt = null, bo_other_usd_comm_ptg = null;
                        Nullable<decimal> bo_paid_attendance = null, bo_comps = null, bo_sub_t_sold = null, bo_ph_t_sold = null, bo_web_t_sold = null, bo_cc_t_sold = null,
                            bo_outlet_t_sold = null, bo_single_tix_t_sold = null, bo_small_group_t_sold = null, bo_large_group_t_sold = null,
                            bo_other_per_t_sold = null, bo_other_usd_t_sold = null, bo_other_3_t_sold = null, bo_other_3_gross_rcpt = null
                            , bo_other_4_t_sold = null, bo_other_4_gross_rcpt = null, bo_other_5_t_sold = null, bo_other_5_gross_rcpt = null,
                            bo_other_3_comm_ptg = null, bo_other_4_comm_ptg = null, bo_other_5_comm_ptg = null;

                        bo_gross_sales = txtgrossales.Text.AutoformatDecimal();
                        bo_facility_fee = txtFacilityfeeoneachticket.Text.AutoformatDecimal();
                        bo_tax1 = decimal.Parse(txtTax1.Text, CultureInfo.InvariantCulture);
                        bo_tax_amount_over = txtTaxAmountOver.Text.AutoformatDecimal();
                        bo_tax_facility_comm = txtTaxFacilityfeecoms.Text.AutoformatDecimal();
                        bo_sub_gross_rcpt = txtSubscriptionreceipts.Text.AutoformatDecimal();
                        bo_sub_comm_ptg = txtSubsSalesPerc.Text.AutoformatDecimal();

                        bo_ph_gross_rcpt = txtPhoneGrossReceipts.Text.AutoformatDecimal();
                        bo_ph_comm_ptg = txtPhonePerc.Text.AutoformatDecimal();

                        bo_web_gross_rcpt = txtInternetGrossRecpt.Text.AutoformatDecimal();
                        bo_web_comm_ptg = txtInternetPerc.Text.AutoformatDecimal();

                        bo_cc_gross_rcpt = txtCreditGrossReceipts.Text.AutoformatDecimal();
                        bo_cc_comm_ptg = txtCreditPerc.Text.AutoformatDecimal();

                        bo_outlet_gross_rcpt = txtRemoteGrossReceipts.Text.AutoformatDecimal();
                        bo_outlet_comm_ptg = txtRemotePerc.Text.AutoformatDecimal();

                        bo_single_tix_gross_rcpt = txtSingletixtGrossReceipts.Text.AutoformatDecimal();
                        bo_single_tix_comm_ptg = txtSingletixPerc.Text.AutoformatDecimal();

                        bo_small_group_gross_rcpt = txtGroupGrossReceipts.Text.AutoformatDecimal();
                        bo_small_group_comm_ptg = txtGroupPerc.Text.AutoformatDecimal();

                        bo_large_group_gross_rcpt = txtGroup1grossReceipts.Text.AutoformatDecimal();
                        bo_large_group_comm_ptg = txtGroup1Perc.Text.AutoformatDecimal();

                        bo_other_per_gross_rcpt = txtOtherPercGrossReceipts.Text.AutoformatDecimal();
                        bo_other_per_comm_ptg = txtOtherPercPerc.Text.AutoformatDecimal();

                        bo_other_usd_gross_rcpt = txtOtherDollGrossReceipts.Text.AutoformatDecimal();
                        bo_other_usd_comm_ptg = txtOtherDollPerc.Text.AutoformatDecimal();

                        bo_drop_count = txtDropcount.Text.AutoformatDecimal();
                        bo_paid_attendance = txtPaidAttendance.Text.AutoformatDecimal();
                        bo_comps = txtComps.Text.AutoformatDecimal();
                        bo_sub_t_sold = txtSubscriptionsold.Text.AutoformatDecimal();
                        bo_ph_t_sold = txtPhoneTcktSold.Text.AutoformatDecimal();
                        bo_web_t_sold = txtInternetTcktSold.Text.AutoformatDecimal();
                        bo_cc_t_sold = txtCreditcrdTcktSold.Text.AutoformatDecimal();
                        bo_outlet_t_sold = txtRemoteoutletTcktSold.Text.AutoformatDecimal();
                        bo_single_tix_t_sold = txtSingletixtcktSold.Text.AutoformatDecimal();
                        bo_small_group_t_sold = txtGroupTicktSold.Text.AutoformatDecimal();
                        bo_large_group_t_sold = txtGroup1TicktSold.Text.AutoformatDecimal();
                        bo_other_per_t_sold = txtOtherPercTcktSold.Text.AutoformatDecimal();
                        bo_other_usd_t_sold = txtOtherDollTcktSold.Text.AutoformatDecimal();

                        bo_other_3_t_sold = txtOther3TcktSold.Text.AutoformatDecimal();
                        bo_other_3_gross_rcpt = txtOther3GrossReceipts.Text.AutoformatDecimal();
                        bo_other_3_comm_ptg = txtOther3Perc.Text.AutoformatDecimal();
                        bo_other_4_t_sold = txtOther4TcktSold.Text.AutoformatDecimal();
                        bo_other_4_gross_rcpt = txtOther4GrossReceipts.Text.AutoformatDecimal();
                        bo_other_4_comm_ptg = txtOther4Perc.Text.AutoformatDecimal();
                        bo_other_5_t_sold = txtOther5TcktSold.Text.AutoformatDecimal();
                        bo_other_5_gross_rcpt = txtOther5GrossReceipts.Text.AutoformatDecimal();
                        bo_other_5_comm_ptg = txtOther5Perc.Text.AutoformatDecimal();

                        ofcobj = new BoxOfficeData();
                        int output;
                        if (ddlPerformance.Visible == true)
                        {
                            output = ofcobj.BoxOffice_Insert(out boid,Convert.ToInt32(hdn_engagementid.Value),
                            Convert.ToInt32(ddlPerformance.SelectedItem.Value),
                            bo_gross_sales, bo_drop_count, bo_paid_attendance, bo_comps, bo_sub_t_sold,
                            bo_sub_gross_rcpt, bo_ph_t_sold, bo_ph_gross_rcpt, bo_web_t_sold, bo_web_gross_rcpt,
                             bo_cc_t_sold, bo_cc_gross_rcpt, bo_outlet_t_sold, bo_outlet_gross_rcpt,
                             bo_single_tix_t_sold, bo_single_tix_gross_rcpt, bo_small_group_t_sold,
                             bo_small_group_gross_rcpt, bo_large_group_t_sold, bo_large_group_gross_rcpt,
                             bo_other_per_t_sold, bo_other_per_gross_rcpt, bo_other_usd_t_sold,
                            bo_other_usd_gross_rcpt,bo_other_3_t_sold, bo_other_3_gross_rcpt,
                            bo_other_4_t_sold, bo_other_4_gross_rcpt,
                            bo_other_5_t_sold, bo_other_5_gross_rcpt
                            );
                            if (output == 1001)
                            {
                                lbl_msg.Text = "Engagement Box Office created successfully";
                                lbl_msg.ForeColor = System.Drawing.Color.Green;
                            }
                            else if (output == 1002)
                            {
                                lbl_msg.Text = "Engagement Box Office updated successfully";
                                lbl_msg.ForeColor = System.Drawing.Color.Green;
                            }
                        }
                        else
                        {
                            foreach (ListItem list in chklstPerformance.Items)
                            {
                                if (list.Selected == true && list.Value != "0")
                                {
                                    output = ofcobj.BoxOffice_Insert(out boid,Convert.ToInt32(hdn_engagementid.Value),
                                        Convert.ToInt32(list.Value),
                                        bo_gross_sales, bo_drop_count, bo_paid_attendance, bo_comps, bo_sub_t_sold,
                                        bo_sub_gross_rcpt, bo_ph_t_sold, bo_ph_gross_rcpt, bo_web_t_sold, bo_web_gross_rcpt,
                                         bo_cc_t_sold, bo_cc_gross_rcpt, bo_outlet_t_sold, bo_outlet_gross_rcpt,
                                         bo_single_tix_t_sold, bo_single_tix_gross_rcpt, bo_small_group_t_sold,
                                         bo_small_group_gross_rcpt, bo_large_group_t_sold, bo_large_group_gross_rcpt,
                                         bo_other_per_t_sold, bo_other_per_gross_rcpt, bo_other_usd_t_sold,
                                        bo_other_usd_gross_rcpt);
                                    if (output == 1001)
                                    {
                                        lbl_msg.Text = "Engagement Box Office created successfully";
                                        lbl_msg.ForeColor = System.Drawing.Color.Green;
                                    }
                                    else if (output == 1002)
                                    {
                                        lbl_msg.Text = "Engagement Box Office updated successfully";
                                        lbl_msg.ForeColor = System.Drawing.Color.Green;
                                    }
                                }
                            }
                        }

                        if (chkboxOverride.Checked)
                        {
                            SaveOverride(boid);
                        }

                        ddlPerformancesload(Convert.ToInt32(hdn_engagementid.Value));
                        //ddlPerformancesload(Convert.ToInt32(hdn_engagementid.Value));
                        ScriptManager.RegisterStartupScript(this, this.GetType(), "", "Subscriptioncalc();", true);

                    }
                    else
                    {
                        lbl_msg.Text = "Please create Engagement Schedule first";
                        lbl_msg.ForeColor = System.Drawing.Color.Red;
                    }
                }
            }
            catch (Exception ex)
            {

                throw ex;
            }
            finally
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "", "Subscriptioncalc();", true);
                ScriptManager.RegisterStartupScript(this, this.GetType(), "", "JQalertbox('actual!');", true);
            }
        }
 public DataTable dealdata()
 {
     DataTable dtdeal = new DataTable();
     ofcobj = new BoxOfficeData();
     dtdeal = ofcobj.Getboxofcdatafromdeal(Convert.ToInt32(hdn_engagementid.Value));
     return dtdeal;
 }
 protected void ddlPerformance_SelectedIndexChanged(object sender, EventArgs e)
 {
     Reset();
     ofcobj = new BoxOfficeData();
     DataTable ds = new DataTable();
     ds = ofcobj.LoadDiscountdata(Convert.ToInt32(hdn_engagementid.Value), Convert.ToInt32(ddlPerformance.SelectedItem.Value.ToString()));
     if (ds.Rows.Count > 0)
     {
         filldatacalculations(ds);
     }
     else
     {
         LoadPerformanceCopy(Convert.ToInt32(hdn_engagementid.Value));
     }
     //if (hdn_engagementid.Value != "" && hdn_schedulecount.Value != "0")
     //{
     //    if (ViewState["dtperformance"] == null)
     //    {
     //        dtperformancelist = ofcobj.GetPerformancelist(Convert.ToInt32(hdn_engagementid.Value));
     //    }
     //    else
     //    {
     //        dtperformancelist = (ViewState["dtperformance"]) as DataTable;
     //    }
     //    DataTable value = performanceddlvalue(dtperformancelist);
     //    if (value.Rows.Count > 0)
     //    {
     //        filldatacalculations(value);
     //    }
     //}
 }
        public void SaveData()
        {
            if (ddlPerformance.Visible == false)
            {
                List<ListItem> items = chklstPerformance.Items.Cast<ListItem>().Where(n => n.Selected).ToList();
                if (items.Count == 0)
                {
                    lbl_message.Text = "Select at least one performance!";
                    return;
                }

            }
            char[] chDlr = { '$', '%', ',', ' ' };
            EngagementMaster EngmtMaster = (EngagementMaster)Page.Master;

            if (hdn_engagementid.Value != "0" && hdn_engagementid.Value != "")
            {
                if (hdn_schedulecount.Value != "0" && hdn_schedulecount.Value != "")
                {
                    Nullable<decimal> dsct_sub1_per = null, dsct_sub2_per = null,
            dsct_sub3_per = null,
            dsct_sub4_per = null,
            dsct_sub5_per = null,
            dsct_sub6_per = null,
            dsct_sub7_per = null,
            dsct_sub8_per = null,
            dsct_sub9_per = null,
            dsct_sub10_per = null,
            dsct_sub1_tickets = null,
            dsct_sub2_tickets = null,
            dsct_sub3_tickets = null,
            dsct_sub4_tickets = null,
            dsct_sub5_tickets = null,
            dsct_sub6_tickets = null,
            dsct_sub7_tickets = null,
            dsct_sub8_tickets = null,
            dsct_sub9_tickets = null,
            dsct_sub10_tickets = null,
            dsct_sml_grp_per = null,
            dsct_lrg_grp_per = null,
            dsct_grp3_per = null,
            dsct_grp4_per = null,
            dsct_grp5_per = null,
            dsct_grp6_per = null,
            dsct_grp7_per = null,
            dsct_grp8_per = null,
            dsct_grp9_per = null,
            dsct_grp10_per = null,
            dsct_sml_grp_tickets = null,
            dsct_lrg_grp_tickets = null,
            dsct_grp3_tickets = null,
            dsct_grp4_tickets = null,
            dsct_grp5_tickets = null,
            dsct_grp6_tickets = null,
            dsct_grp7_tickets = null,
            dsct_grp8_tickets = null,
            dsct_grp9_tickets = null,
            dsct_grp10_tickets = null,
            dsct_misc1_per = null,
            dsct_misc2_per = null,
            dsct_misc3_per = null,
            dsct_misc4_per = null,
            dsct_misc5_per = null,
            dsct_misc6_per = null,
            dsct_misc7_per = null,
            dsct_misc8_per = null,
            dsct_misc9_per = null,
            dsct_misc10_per = null,
            dsct_misc1_tickets = null,
            dsct_misc2_tickets = null,
            dsct_misc3_tickets = null,
            dsct_misc4_tickets = null,
            dsct_misc5_tickets = null,
            dsct_misc6_tickets = null,
            dsct_misc7_tickets = null,
            dsct_misc8_tickets = null,
            dsct_misc9_tickets = null,
            dsct_misc10_tickets = null,
            dsct_demand_price = null;

                    dsct_sub1_per = (txtSubs1Perc.Text != "") ? Convert.ToDecimal(txtSubs1Perc.Text.Trim(chDlr)) : dsct_sub1_per;
                    dsct_sub2_per = (txtSubs2Perc.Text != "") ? Convert.ToDecimal(txtSubs2Perc.Text.Trim(chDlr)) : dsct_sub2_per;
                    dsct_sub3_per = (txtSubs3Perc.Text != "") ? Convert.ToDecimal(txtSubs3Perc.Text.Trim(chDlr)) : dsct_sub3_per;
                    dsct_sub4_per = (txtSubs4Perc.Text != "") ? Convert.ToDecimal(txtSubs4Perc.Text.Trim(chDlr)) : dsct_sub4_per;
                    dsct_sub5_per = (txtSubs5Perc.Text != "") ? Convert.ToDecimal(txtSubs5Perc.Text.Trim(chDlr)) : dsct_sub5_per;
                    dsct_sub6_per = (txtSubs6Perc.Text != "") ? Convert.ToDecimal(txtSubs6Perc.Text.Trim(chDlr)) : dsct_sub6_per;
                    dsct_sub7_per = (txtSubs7Perc.Text != "") ? Convert.ToDecimal(txtSubs7Perc.Text.Trim(chDlr)) : dsct_sub7_per;
                    dsct_sub8_per = (txtSubs8Perc.Text != "") ? Convert.ToDecimal(txtSubs8Perc.Text.Trim(chDlr)) : dsct_sub8_per;
                    dsct_sub9_per = (txtSubs9Perc.Text != "") ? Convert.ToDecimal(txtSubs9Perc.Text.Trim(chDlr)) : dsct_sub9_per;
                    dsct_sub10_per = (txtSubs10Perc.Text != "") ? Convert.ToDecimal(txtSubs10Perc.Text.Trim(chDlr)) : dsct_sub10_per;
                    dsct_sub1_tickets = (txtSubs1Tickets.Text != "") ? Convert.ToDecimal(txtSubs1Tickets.Text.Trim(chDlr)) : dsct_sub1_tickets;
                    dsct_sub2_tickets = (txtSubs2Tickets.Text != "") ? Convert.ToDecimal(txtSubs2Tickets.Text.Trim(chDlr)) : dsct_sub2_tickets;
                    dsct_sub3_tickets = (txtSubs3Tickets.Text != "") ? Convert.ToDecimal(txtSubs3Tickets.Text.Trim(chDlr)) : dsct_sub3_tickets;
                    dsct_sub4_tickets = (txtSubs4Tickets.Text != "") ? Convert.ToDecimal(txtSubs4Tickets.Text.Trim(chDlr)) : dsct_sub4_tickets;
                    dsct_sub5_tickets = (txtSubs5Tickets.Text != "") ? Convert.ToDecimal(txtSubs5Tickets.Text.Trim(chDlr)) : dsct_sub5_tickets;
                    dsct_sub6_tickets = (txtSubs6Tickets.Text != "") ? Convert.ToDecimal(txtSubs6Tickets.Text.Trim(chDlr)) : dsct_sub6_tickets;
                    dsct_sub7_tickets = (txtSubs7Tickets.Text != "") ? Convert.ToDecimal(txtSubs7Tickets.Text.Trim(chDlr)) : dsct_sub7_tickets;
                    dsct_sub8_tickets = (txtSubs8Tickets.Text != "") ? Convert.ToDecimal(txtSubs8Tickets.Text.Trim(chDlr)) : dsct_sub8_tickets;
                    dsct_sub9_tickets = (txtSubs9Tickets.Text != "") ? Convert.ToDecimal(txtSubs9Tickets.Text.Trim(chDlr)) : dsct_sub9_tickets;
                    dsct_sub10_tickets = (txtSubs10Tickets.Text != "") ? Convert.ToDecimal(txtSubs10Tickets.Text.Trim(chDlr)) : dsct_sub10_tickets;
                    dsct_sml_grp_per = (txtgrouplessPerc1.Text != "") ? Convert.ToDecimal(txtgrouplessPerc1.Text.Trim(chDlr)) : dsct_sml_grp_per;
                    dsct_lrg_grp_per = (txtgrouplessPerc2.Text != "") ? Convert.ToDecimal(txtgrouplessPerc2.Text.Trim(chDlr)) : dsct_lrg_grp_per;
                    dsct_grp3_per = (txtgrouplessPerc3.Text != "") ? Convert.ToDecimal(txtgrouplessPerc3.Text.Trim(chDlr)) : dsct_grp3_per;
                    dsct_grp4_per = (txtgrouplessPerc4.Text != "") ? Convert.ToDecimal(txtgrouplessPerc4.Text.Trim(chDlr)) : dsct_grp4_per;
                    dsct_grp5_per = (txtgrouplessPerc5.Text != "") ? Convert.ToDecimal(txtgrouplessPerc5.Text.Trim(chDlr)) : dsct_grp5_per;
                    dsct_grp6_per = (txtgrouplessPerc6.Text != "") ? Convert.ToDecimal(txtgrouplessPerc6.Text.Trim(chDlr)) : dsct_grp6_per;
                    dsct_grp7_per = (txtgrouplessPerc7.Text != "") ? Convert.ToDecimal(txtgrouplessPerc7.Text.Trim(chDlr)) : dsct_grp7_per;
                    dsct_grp8_per = (txtgrouplessPerc8.Text != "") ? Convert.ToDecimal(txtgrouplessPerc8.Text.Trim(chDlr)) : dsct_grp8_per;
                    dsct_grp9_per = (txtgrouplessPerc9.Text != "") ? Convert.ToDecimal(txtgrouplessPerc9.Text.Trim(chDlr)) : dsct_grp9_per;
                    dsct_grp10_per = (txtgrouplessPerc10.Text != "") ? Convert.ToDecimal(txtgrouplessPerc10.Text.Trim(chDlr)) : dsct_grp10_per;
                    dsct_sml_grp_tickets = (txtGrouplessTickets1.Text != "") ? Convert.ToDecimal(txtGrouplessTickets1.Text.Trim(chDlr)) : dsct_sml_grp_tickets;
                    dsct_lrg_grp_tickets = (txtGrouplessTickets2.Text != "") ? Convert.ToDecimal(txtGrouplessTickets2.Text.Trim(chDlr)) : dsct_lrg_grp_tickets;
                    dsct_grp3_tickets = (txtGrouplessTickets3.Text != "") ? Convert.ToDecimal(txtGrouplessTickets3.Text.Trim(chDlr)) : dsct_grp3_tickets;
                    dsct_grp4_tickets = (txtGrouplessTickets4.Text != "") ? Convert.ToDecimal(txtGrouplessTickets4.Text.Trim(chDlr)) : dsct_grp4_tickets;
                    dsct_grp5_tickets = (txtGrouplessTickets5.Text != "") ? Convert.ToDecimal(txtGrouplessTickets5.Text.Trim(chDlr)) : dsct_grp5_tickets;
                    dsct_grp6_tickets = (txtGrouplessTickets6.Text != "") ? Convert.ToDecimal(txtGrouplessTickets6.Text.Trim(chDlr)) : dsct_grp6_tickets;
                    dsct_grp7_tickets = (txtGrouplessTickets7.Text != "") ? Convert.ToDecimal(txtGrouplessTickets7.Text.Trim(chDlr)) : dsct_grp7_tickets;
                    dsct_grp8_tickets = (txtGrouplessTickets8.Text != "") ? Convert.ToDecimal(txtGrouplessTickets8.Text.Trim(chDlr)) : dsct_grp8_tickets;
                    dsct_grp9_tickets = (txtGrouplessTickets9.Text != "") ? Convert.ToDecimal(txtGrouplessTickets9.Text.Trim(chDlr)) : dsct_grp9_tickets;
                    dsct_grp10_tickets = (txtGrouplessTickets10.Text != "") ? Convert.ToDecimal(txtGrouplessTickets10.Text.Trim(chDlr)) : dsct_grp10_tickets;
                    dsct_misc1_per = (txtMiscellaneousPerc1.Text != "") ? Convert.ToDecimal(txtMiscellaneousPerc1.Text.Trim(chDlr)) : dsct_misc1_per;
                    dsct_misc2_per = (txtMiscellaneousPerc2.Text != "") ? Convert.ToDecimal(txtMiscellaneousPerc2.Text.Trim(chDlr)) : dsct_misc2_per;
                    dsct_misc3_per = (txtMiscellaneousPerc3.Text != "") ? Convert.ToDecimal(txtMiscellaneousPerc3.Text.Trim(chDlr)) : dsct_misc3_per;
                    dsct_misc4_per = (txtMiscellaneousPerc4.Text != "") ? Convert.ToDecimal(txtMiscellaneousPerc4.Text.Trim(chDlr)) : dsct_misc4_per;
                    dsct_misc5_per = (txtMiscellaneousPerc5.Text != "") ? Convert.ToDecimal(txtMiscellaneousPerc5.Text.Trim(chDlr)) : dsct_misc5_per;
                    dsct_misc6_per = (txtMiscellaneousPerc6.Text != "") ? Convert.ToDecimal(txtMiscellaneousPerc6.Text.Trim(chDlr)) : dsct_misc6_per;
                    dsct_misc7_per = (txtMiscellaneousPerc7.Text != "") ? Convert.ToDecimal(txtMiscellaneousPerc7.Text.Trim(chDlr)) : dsct_misc7_per;
                    dsct_misc8_per = (txtMiscellaneousPerc8.Text != "") ? Convert.ToDecimal(txtMiscellaneousPerc8.Text.Trim(chDlr)) : dsct_misc8_per;
                    dsct_misc9_per = (txtMiscellaneousPerc9.Text != "") ? Convert.ToDecimal(txtMiscellaneousPerc9.Text.Trim(chDlr)) : dsct_misc9_per;
                    dsct_misc10_per = (txtMiscellaneousPerc10.Text != "") ? Convert.ToDecimal(txtMiscellaneousPerc10.Text.Trim(chDlr)) : dsct_misc10_per;
                    dsct_misc1_tickets = (txtMiscellaneousTickets1.Text != "") ? Convert.ToDecimal(txtMiscellaneousTickets1.Text.Trim(chDlr)) : dsct_misc1_tickets;
                    dsct_misc2_tickets = (txtMiscellaneousTickets2.Text != "") ? Convert.ToDecimal(txtMiscellaneousTickets2.Text.Trim(chDlr)) : dsct_misc2_tickets;
                    dsct_misc3_tickets = (txtMiscellaneousTickets3.Text != "") ? Convert.ToDecimal(txtMiscellaneousTickets3.Text.Trim(chDlr)) : dsct_misc3_tickets;
                    dsct_misc4_tickets = (txtMiscellaneousTickets4.Text != "") ? Convert.ToDecimal(txtMiscellaneousTickets4.Text.Trim(chDlr)) : dsct_misc4_tickets;
                    dsct_misc5_tickets = (txtMiscellaneousTickets5.Text != "") ? Convert.ToDecimal(txtMiscellaneousTickets5.Text.Trim(chDlr)) : dsct_misc5_tickets;
                    dsct_misc6_tickets = (txtMiscellaneousTickets6.Text != "") ? Convert.ToDecimal(txtMiscellaneousTickets6.Text.Trim(chDlr)) : dsct_misc6_tickets;
                    dsct_misc7_tickets = (txtMiscellaneousTickets7.Text != "") ? Convert.ToDecimal(txtMiscellaneousTickets7.Text.Trim(chDlr)) : dsct_misc7_tickets;
                    dsct_misc8_tickets = (txtMiscellaneousTickets8.Text != "") ? Convert.ToDecimal(txtMiscellaneousTickets8.Text.Trim(chDlr)) : dsct_misc8_tickets;
                    dsct_misc9_tickets = (txtMiscellaneousTickets9.Text != "") ? Convert.ToDecimal(txtMiscellaneousTickets9.Text.Trim(chDlr)) : dsct_misc9_tickets;
                    dsct_misc10_tickets = (txtMiscellaneousTickets10.Text != "") ? Convert.ToDecimal(txtMiscellaneousTickets10.Text.Trim(chDlr)) : dsct_misc10_tickets;
                    dsct_demand_price = (txtDemandPricing.Text != "") ? Convert.ToDecimal(txtDemandPricing.Text.Trim(chDlr)) : dsct_demand_price;
                    ofcobj = new BoxOfficeData();
                    int output;
                    if (ddlPerformance.Visible == true)
                    {
                        output = ofcobj.Discount_Insert(Convert.ToInt32(hdn_engagementid.Value), Convert.ToInt32(ddlPerformance.SelectedItem.Value),
                            dsct_sub1_per, dsct_sub2_per, dsct_sub3_per, dsct_sub4_per, dsct_sub5_per, dsct_sub6_per, dsct_sub7_per, dsct_sub8_per, dsct_sub9_per, dsct_sub10_per,
                            dsct_sub1_tickets, dsct_sub2_tickets, dsct_sub3_tickets,
            dsct_sub4_tickets,
            dsct_sub5_tickets,
            dsct_sub6_tickets, dsct_sub7_tickets, dsct_sub8_tickets, dsct_sub9_tickets, dsct_sub10_tickets,
            dsct_sml_grp_per,
            dsct_lrg_grp_per, dsct_grp3_per, dsct_grp4_per, dsct_grp5_per, dsct_grp6_per, dsct_grp7_per, dsct_grp8_per, dsct_grp9_per, dsct_grp10_per,
            dsct_sml_grp_tickets,
            dsct_lrg_grp_tickets, dsct_grp3_tickets, dsct_grp4_tickets, dsct_grp5_tickets, dsct_grp6_tickets, dsct_grp7_tickets, dsct_grp8_tickets, dsct_grp9_tickets, dsct_grp10_tickets,
            dsct_misc1_per,
            dsct_misc2_per,
            dsct_misc3_per,
            dsct_misc4_per, dsct_misc5_per, dsct_misc6_per, dsct_misc7_per, dsct_misc8_per, dsct_misc9_per, dsct_misc10_per,
            dsct_misc1_tickets,
            dsct_misc2_tickets,
            dsct_misc3_tickets,
            dsct_misc4_tickets, dsct_misc5_tickets, dsct_misc6_tickets, dsct_misc7_tickets, dsct_misc8_tickets, dsct_misc9_tickets, dsct_misc10_tickets,
            dsct_demand_price, txtnotes.Text.Trim());
                        if (output == 1001)
                        {
                            lbl_msg.Text = "Engagement Discount created successfully";
                            lbl_msg.ForeColor = System.Drawing.Color.Green;
                        }
                        else if (output == 1002)
                        {
                            lbl_msg.Text = "Engagement Discount updated successfully";
                            lbl_msg.ForeColor = System.Drawing.Color.Green;
                        }

                    }
                    else
                    {
                        foreach (ListItem list in chklstPerformance.Items)
                        {
                            if (list.Selected == true && list.Value != "0")
                            {

                                output = ofcobj.Discount_Insert(Convert.ToInt32(hdn_engagementid.Value), Convert.ToInt32(list.Value),
                           dsct_sub1_per, dsct_sub2_per, dsct_sub3_per, dsct_sub4_per, dsct_sub5_per, dsct_sub6_per, dsct_sub7_per, dsct_sub8_per, dsct_sub9_per, dsct_sub10_per,
                            dsct_sub1_tickets, dsct_sub2_tickets, dsct_sub3_tickets,
            dsct_sub4_tickets,
            dsct_sub5_tickets,
            dsct_sub6_tickets, dsct_sub7_tickets, dsct_sub8_tickets, dsct_sub9_tickets, dsct_sub10_tickets,
            dsct_sml_grp_per,
            dsct_lrg_grp_per, dsct_grp3_per, dsct_grp4_per, dsct_grp5_per, dsct_grp6_per, dsct_grp7_per, dsct_grp8_per, dsct_grp9_per, dsct_grp10_per,
            dsct_sml_grp_tickets,
            dsct_lrg_grp_tickets, dsct_grp3_tickets, dsct_grp4_tickets, dsct_grp5_tickets, dsct_grp6_tickets, dsct_grp7_tickets, dsct_grp8_tickets, dsct_grp9_tickets, dsct_grp10_tickets,
            dsct_misc1_per,
            dsct_misc2_per,
            dsct_misc3_per,
            dsct_misc4_per, dsct_misc5_per, dsct_misc6_per, dsct_misc7_per, dsct_misc8_per, dsct_misc9_per, dsct_misc10_per,
            dsct_misc1_tickets,
            dsct_misc2_tickets,
            dsct_misc3_tickets,
            dsct_misc4_tickets, dsct_misc5_tickets, dsct_misc6_tickets, dsct_misc7_tickets, dsct_misc8_tickets, dsct_misc9_tickets, dsct_misc10_tickets,
            dsct_demand_price, txtnotes.Text.Trim());
                                if (output == 1001)
                                {
                                    lbl_msg.Text = "Engagement Discount created successfully";
                                    lbl_msg.ForeColor = System.Drawing.Color.Green;
                                }
                                else if (output == 1002)
                                {
                                    lbl_msg.Text = "Engagement Discount updated successfully";
                                    lbl_msg.ForeColor = System.Drawing.Color.Green;
                                }
                            }
                        }
                    }
                    ucdocx.SaveDocx(Convert.ToInt32(ddlPerformance.SelectedItem.Value), "Schedule");
                    // int index = ddlPerformance.SelectedIndex;
                    ddlPerformancesload(Convert.ToInt32(hdn_engagementid.Value));
                    //LoadPerformanceCopy(Convert.ToInt32(hdn_engagementid.Value));
                    // ddlPerformance.SelectedIndex = index;
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "", "sysmbols();", true);
                }
                else
                {
                    lbl_msg.Text = "Please create Engagement Schedule first";
                    lbl_msg.ForeColor = System.Drawing.Color.Red;
                }
            }
        }
        public void loadperformanceddl(int engmntid)
        {
            ofcobj = new BoxOfficeData();
            //dtperformancelist = ofcobj.GetPerformancelist(engmntid);
            dtperformancelist = ofcobj.LoadPerformancelist(engmntid);
            ViewState["dtperformance"] = dtperformancelist;
            ddlPerformance.DataSource = dtperformancelist;
            ddlPerformance.DataTextField = "schedule_type";
            ddlPerformance.DataValueField = "schedule_id";
            ddlPerformance.DataBind();
            if (dtperformancelist != null)
            {
                if (ddlPerformance.Items.Count > 0)
                    ddlPerformance.SelectedIndex = 0;
            }

            chklstPerformance.DataSource = dtperformancelist;
            chklstPerformance.DataTextField = "schedule_type";
            chklstPerformance.DataValueField = "schedule_id";
            chklstPerformance.DataBind();
            ListItem lst = new ListItem();
            lst.Text = "All";
            lst.Value = "0";
            lst.Attributes.Add("Class", "YellowSpan");
            chklstPerformance.Items.Insert(0, lst);
        }