public void loadCreateddate()
 {
     objshow = new MasterData();
     objrpt = new ReportData();
     DataTable dt = new DataTable();
     Nullable<int> venueid = null;
     venueid = (ddlVenue.SelectedIndex > 0) ? Convert.ToInt32(ddlVenue.SelectedItem.Value) : venueid;
     dt = objrpt.GetEngtReportParameters("D", Convert.ToInt32(ddlShow.SelectedItem.Value), Convert.ToInt32(ddlCity.SelectedItem.Value), venueid);
     objcf.FillDropDownList(ddlCreateddate, dt, "ENGTSTARTDATE", "ENGAGEMENTID");
     if (dt.Rows.Count == 1)
     {
         ddlCreateddate.SelectedIndex = 1;
         LoadEnddate();
     }
 }
        public void LoadReport()
        {
            objrpt = new ReportData();
            int _showid = Convert.ToInt32(ddlShow.SelectedItem.Value);
            int _Month = Convert.ToDateTime(txtDate.Text).Month;
            int _Year = Convert.ToDateTime(txtDate.Text).Year;
            _Year = (_Month < 7) ? --_Year : _Year;
            dt = objrpt.GetProFormaReportData(_showid, _Year);
            if (dt.Rows.Count > 0)
            {
                trexcel.Visible = true;
                Template(dt, _Year);
            }
            else
            {
                lblerror.Text = "No records found!";
                trexcel.Visible = false;

            }
        }
 public void LoadEnddate()
 {
     lblEngtEndDate.Text = string.Empty;
     objshow = new MasterData();
     objrpt = new ReportData();
     DataTable dt = new DataTable();
     Nullable<int> venueid = null;
     venueid = (ddlVenue.SelectedIndex > 0) ? Convert.ToInt32(ddlVenue.SelectedItem.Value) : venueid;
     dt = objrpt.GetEngtReportParameters("E", Convert.ToInt32(ddlCreateddate.SelectedItem.Value), venueid, venueid);
     if (dt.Rows.Count > 0)
     {
         lblEngtEndDate.Text = dt.Rows[0]["ENGTENDDATE"].ToString();
     }
 }
        public void filldatas()
        {
            ReportData objrpt = new ReportData();
            DataTable dt = new DataTable();
            decimal dis = Convert.ToDecimal(txtDiscountcap.Text.Replace("%", ""));
            dt = objrpt.GetBreakevendata(Convert.ToInt32(ddlShow.SelectedItem.Value),
                Convert.ToInt32(ddlCity.SelectedItem.Value), Convert.ToInt32(ddlVenue.SelectedItem.Value),
                Convert.ToDateTime(ddlCreateddate.SelectedItem.Text), Convert.ToDateTime(lblEngtEndDate.Text),
                dis, Convert.ToInt32(ddlCreateddate.SelectedValue));
            if (dt.Rows.Count > 0)
            {
                txtNoofshowsperweek.Text = string.IsNullOrEmpty(dt.Rows[0]["performance"].ToString()) ? "0" : dt.Rows[0]["performance"].ToString();
                txtNoofweeks.Text = string.IsNullOrEmpty(dt.Rows[0]["noofweeks"].ToString()) ? "0" : dt.Rows[0]["noofweeks"].ToString();
                txtSeatspershow.Text = string.IsNullOrEmpty(dt.Rows[0]["seatspershow"].ToString()) ? "0" : dt.Rows[0]["seatspershow"].ToString();
                txtWeeklygrospotential.Text = string.IsNullOrEmpty(dt.Rows[0]["weeklygrosspotential"].ToString()) ? "0" : dt.Rows[0]["weeklygrosspotential"].ToString();
                lblNetavgpertix.Text = string.IsNullOrEmpty(dt.Rows[0]["Netavg"].ToString()) ? "0" : dt.Rows[0]["Netavg"].ToString();
                txtExchangerate.Text = string.IsNullOrEmpty(dt.Rows[0]["exchangerate"].ToString()) ? "0" : dt.Rows[0]["exchangerate"].ToString();
                txtSubloadin.Text = string.IsNullOrEmpty(dt.Rows[0]["subloadin"].ToString()) ? "0" : dt.Rows[0]["subloadin"].ToString();
                lblSubloadin.Text = string.IsNullOrEmpty(dt.Rows[0]["subloadin"].ToString()) ? "0" : dt.Rows[0]["subloadin"].ToString();
                lblSubloadin1.Text = string.IsNullOrEmpty(dt.Rows[0]["subloadin"].ToString()) ? "0" : dt.Rows[0]["subloadin"].ToString();
                lblSubloadin2.Text = string.IsNullOrEmpty(dt.Rows[0]["subloadin"].ToString()) ? "0" : dt.Rows[0]["subloadin"].ToString();
                lblSubloadin3.Text = string.IsNullOrEmpty(dt.Rows[0]["subloadin"].ToString()) ? "0" : dt.Rows[0]["subloadin"].ToString();
                lblSubloadin4.Text = string.IsNullOrEmpty(dt.Rows[0]["subloadin"].ToString()) ? "0" : dt.Rows[0]["subloadin"].ToString();
                lblSubloadin5.Text = string.IsNullOrEmpty(dt.Rows[0]["subloadin"].ToString()) ? "0" : dt.Rows[0]["subloadin"].ToString();
                lblSubloadin6.Text = string.IsNullOrEmpty(dt.Rows[0]["subloadin"].ToString()) ? "0" : dt.Rows[0]["subloadin"].ToString();
                lblSubloadin7.Text = string.IsNullOrEmpty(dt.Rows[0]["subloadin"].ToString()) ? "0" : dt.Rows[0]["subloadin"].ToString();
                lblSubloadinBreak.Text = string.IsNullOrEmpty(dt.Rows[0]["subloadin"].ToString()) ? "0" : dt.Rows[0]["subloadin"].ToString();

                //lblNoofweeks.Text = dt.Rows[0]["noofweeks"].ToString())?"0":
                //lblNoofweeks1.Text = dt.Rows[0]["noofweeks"].ToString())?"0":
                //lblNoofweeks2.Text = dt.Rows[0]["noofweeks"].ToString())?"0":
                //lblNoofweeks3.Text = dt.Rows[0]["noofweeks"].ToString())?"0":
                //lblNoofweeks4.Text = dt.Rows[0]["noofweeks"].ToString())?"0":
                //lblNoofweeks5.Text = dt.Rows[0]["noofweeks"].ToString())?"0":
                //lblNoofweeks6.Text = dt.Rows[0]["noofweeks"].ToString())?"0":
                //lblNoofweeks7.Text = dt.Rows[0]["noofweeks"].ToString())?"0":

                lblBoxofcgrosssale.Text = string.IsNullOrEmpty(dt.Rows[0]["bo_gross_sales"].ToString()) ? "0" : dt.Rows[0]["bo_gross_sales"].ToString();
                txtLessDiscounts.Text = string.IsNullOrEmpty(dt.Rows[0]["LessDiscount"].ToString()) ? "0" : dt.Rows[0]["LessDiscount"].ToString();
                txtTax.Text = string.IsNullOrEmpty(dt.Rows[0]["deal_tax_ptg"].ToString()) ? "0" : dt.Rows[0]["deal_tax_ptg"].ToString();
                txtRestoration.Text = string.IsNullOrEmpty(dt.Rows[0]["deal_facility_fee_amt"].ToString()) ? "0" : dt.Rows[0]["deal_facility_fee_amt"].ToString();
                txtSubscriptioncharge.Text = string.IsNullOrEmpty(dt.Rows[0]["deal_sub_sales_comm"].ToString()) ? "0" : dt.Rows[0]["deal_sub_sales_comm"].ToString();
                txtCCothercommissions.Text = string.IsNullOrEmpty(dt.Rows[0]["creditcardothercommisn"].ToString()) ? "0" : dt.Rows[0]["creditcardothercommisn"].ToString();
                txtGuarantee.Text = string.IsNullOrEmpty(dt.Rows[0]["deal_guarantee_income"].ToString()) ? "0" : dt.Rows[0]["deal_guarantee_income"].ToString();
                txtRoyalty.Text = string.IsNullOrEmpty(dt.Rows[0]["deal_royalty_income"].ToString()) ? "0" : dt.Rows[0]["deal_royalty_income"].ToString();
                txtFixedCosts.Text = string.IsNullOrEmpty(dt.Rows[0]["exp_l_local_fixed_bgt"].ToString()) ? "0" : dt.Rows[0]["exp_l_local_fixed_bgt"].ToString();
                txtAdHouseEquipment.Text = string.IsNullOrEmpty(dt.Rows[0]["exp_l_equip_rental_act"].ToString()) ? "0" : dt.Rows[0]["exp_l_equip_rental_act"].ToString();
                txtAdvertising.Text = string.IsNullOrEmpty(dt.Rows[0]["exp_d_ad_gross_act"].ToString()) ? "0" : dt.Rows[0]["exp_d_ad_gross_act"].ToString();
                txtCatering.Text = string.IsNullOrEmpty(dt.Rows[0]["exp_l_catering_act"].ToString()) ? "0" : dt.Rows[0]["exp_l_catering_act"].ToString();
                txtInsurance.Text = string.IsNullOrEmpty(dt.Rows[0]["exp_d_insurance_act"].ToString()) ? "0" : dt.Rows[0]["exp_d_insurance_act"].ToString();
                txtFireWatch.Text = string.IsNullOrEmpty(dt.Rows[0]["firewatch"].ToString()) ? "0" : dt.Rows[0]["firewatch"].ToString();
                txtMusicians.Text = string.IsNullOrEmpty(dt.Rows[0]["exp_d_musician_act"].ToString()) ? "0" : dt.Rows[0]["exp_d_musician_act"].ToString();
                txtRent.Text = string.IsNullOrEmpty(dt.Rows[0]["exp_l_rent_act"].ToString()) ? "0" : dt.Rows[0]["exp_l_rent_act"].ToString();
                txtStagehandsloadin.Text = string.IsNullOrEmpty(dt.Rows[0]["exp_d_stghand_loadin_act"].ToString()) ? "0" : dt.Rows[0]["exp_d_stghand_loadin_act"].ToString();
                txtStagehandsrunning.Text = string.IsNullOrEmpty(dt.Rows[0]["exp_d_stghand_running_act"].ToString()) ? "0" : dt.Rows[0]["exp_d_stghand_running_act"].ToString();
                txtTicketprinting.Text = string.IsNullOrEmpty(dt.Rows[0]["exp_l_ticket_print_act"].ToString()) ? "0" : dt.Rows[0]["exp_l_ticket_print_act"].ToString();
                txtWardrobehairloadin.Text = string.IsNullOrEmpty(dt.Rows[0]["exp_d_wardrobe_loadin_act"].ToString()) ? "0" : dt.Rows[0]["exp_d_wardrobe_loadin_act"].ToString();
                txtWardrobehairrunning.Text = string.IsNullOrEmpty(dt.Rows[0]["exp_d_wardrobe_running_act"].ToString()) ? "0" : dt.Rows[0]["exp_d_wardrobe_running_act"].ToString();
                txtPF.Text = string.IsNullOrEmpty(dt.Rows[0]["exp_l_presenter_profit_act"].ToString()) ? "0" : dt.Rows[0]["exp_l_presenter_profit_act"].ToString();
                txtOther.Text = string.IsNullOrEmpty(dt.Rows[0]["other"].ToString()) ? "0" : dt.Rows[0]["other"].ToString();
                txtNMTP.Text = string.IsNullOrEmpty(dt.Rows[0]["NMTP"].ToString()) ? "0" : dt.Rows[0]["NMTP"].ToString();
                txtNMTPTR.Text = string.IsNullOrEmpty(dt.Rows[0]["NMTPTR"].ToString()) ? "0" : dt.Rows[0]["NMTPTR"].ToString();
                txtPShare.Text = string.IsNullOrEmpty(dt.Rows[0]["presentersharesplit"].ToString()) ? "0" : dt.Rows[0]["presentersharesplit"].ToString();
                //txtPShareofsplit.Text = string.IsNullOrEmpty(dt.Rows[0]["producersharesplit"].ToString()) ? "0" : dt.Rows[0]["producersharesplit"].ToString();
                txtPShareofsplit.Text = Convert.ToString((100) - Convert.ToDecimal(txtPShare.Text));
                txtLessTWS.Text = string.IsNullOrEmpty(dt.Rows[0]["deal_incm_wthd_tax_bgt_amt_per"].ToString()) ? "0" : dt.Rows[0]["deal_incm_wthd_tax_bgt_amt_per"].ToString();
                txtLessTWamt.Text = string.IsNullOrEmpty(dt.Rows[0]["deal_incm_wthd_tax_bgt_amt"].ToString()) ? "0" : dt.Rows[0]["deal_incm_wthd_tax_bgt_amt"].ToString();
                txtWOE.Text = string.IsNullOrEmpty(dt.Rows[0]["show_wkly_operating_expense"].ToString()) ? "0" : dt.Rows[0]["show_wkly_operating_expense"].ToString();
                txtVR.Text = string.IsNullOrEmpty(dt.Rows[0]["show_var_rolyalties"].ToString()) ? "0" : dt.Rows[0]["show_var_rolyalties"].ToString();
                ddlTerm.SelectedIndex = ddlTerm.Items.IndexOf(ddlTerm.Items.FindByValue(dt.Rows[0]["TermDeal"].ToString()));

                chkAddlHouseEquipment.Checked = true;
                chkAdvertising.Checked = true;
                chkCatering.Checked = true;
                chkFireWatch.Checked = true;
                chkFixedCosts.Checked = true;
                chkGuarantee.Checked = true;
                chkInsurance.Checked = true;
                chkMusicians.Checked = true;
                chkOther.Checked = true;
                chkPresenterProfit.Checked = true;
                chkRent.Checked = true;
                chkRoyalty.Checked = true;
                chkStagehandsLoadInOut.Checked = true;
                chkStagehandsRunning.Checked = true;
                chkTicketPrinting.Checked = true;
                chkWardrobeHairLoadInOut.Checked = true;
                chkWardrobeHairRunning.Checked = true;

                //ScriptManager.RegisterStartupScript(this, this.GetType(), "", "calculate();saveconfirm();", true);

            }
        }
        protected void imgExcel_Click(object sender, EventArgs e)
        {
            try
            {
                imgExcel.Visible = true;
                ReportData objrpt = new ReportData();
                DataTable dt = new DataTable();
                decimal dis = Convert.ToDecimal(txtDiscountcap.Text.Replace("%", ""));
                dt = objrpt.GetBreakevendata(Convert.ToInt32(ddlShow.SelectedItem.Value), Convert.ToInt32(ddlCity.SelectedItem.Value), Convert.ToInt32(ddlVenue.SelectedItem.Value), Convert.ToDateTime(ddlCreateddate.SelectedItem.Text), Convert.ToDateTime(lblEngtEndDate.Text), dis, Convert.ToInt32(ddlCreateddate.SelectedValue));
                if (dt.Rows.Count > 0)
                {
                    Template(dt);
                }
            }
            catch (Exception ex)
            {

                throw ex;
            }
        }
 protected void btncalculation_Click(object sender, EventArgs e)
 {
     if (hfstatus.Value == "true")
     {
         ReportData objrpt = new ReportData();
         DataTable dt = new DataTable();
         decimal dis = Convert.ToDecimal(txtDiscountcap.Text.Replace("%", ""));
         dt = objrpt.GetBreakevendata(Convert.ToInt32(ddlShow.SelectedItem.Value), Convert.ToInt32(ddlCity.SelectedItem.Value), Convert.ToInt32(ddlVenue.SelectedItem.Value), Convert.ToDateTime(ddlCreateddate.SelectedItem.Text), Convert.ToDateTime(lblEngtEndDate.Text), dis, Convert.ToInt32(ddlCreateddate.SelectedValue));
         if (dt.Rows.Count > 0)
         {
             Template(dt);
         }
         imgExcel.Visible = true;
         BEval();
     }
     hfstatus.Value = "";
     //txtSubloadin.CssClass = "Numeric";
 }