Exemple #1
0
    protected void InvoiceDetails()
    {
        try
        {
            //ClearInvoiceControl();
            UserName          = Membership.GetUser().UserName;
            ProductDivisionId = 13;
            YearId            = Convert.ToInt32(Ddlyear.SelectedValue);
            if (ddlSerContractor.SelectedValue.Equals("0"))
            {
                spnSoldto.Visible = false;
            }
            if (!string.IsNullOrEmpty(ddlMonth.SelectedValue) && ddlMonth.SelectedValue != "0")
            {
                MonthId = Convert.ToInt32(ddlMonth.SelectedValue);
            }
            else
            {
                MonthId = DateTime.Now.Month;
                ddlMonth.SelectedValue = DateTime.Now.Month.ToString();
            }
            hdnRawUrl.Value = "yId=" + YearId.ToString() + "&mId=" + MonthId.ToString();

            if (!Roles.GetRolesForUser(objCommonMIS.EmpId).Any(x => (x.Contains("SC") || x.Contains("SC_SIMS"))))
            {
                AscId           = Convert.ToInt32(ddlSerContractor.SelectedValue);
                RegionId        = Convert.ToInt32(ddlRegion.SelectedValue);
                BranchId        = Convert.ToInt32(ddlBranch.SelectedValue);
                hdnRawUrl.Value = hdnRawUrl.Value + "&arb=" + ddlSerContractor.SelectedValue + "|" + ddlRegion.SelectedValue + "|" + ddlBranch.SelectedValue;
                hdnRawUrl.Value = hdnRawUrl.Value + "&rbv=" + ddlRegion.SelectedItem.Text + "|" + ddlBranch.SelectedItem.Text;
            }
            else
            {
                AscId           = 0;
                RegionId        = 0;
                BranchId        = 0;
                hdnRawUrl.Value = hdnRawUrl.Value + "&arb=";
                hdnRawUrl.Value = hdnRawUrl.Value + "&rbv=";
            }
            DataSet dsInvoice = GetInvoiceDetails();


            if (dsInvoice != null)
            {
                if (dsInvoice.Tables[1].Rows.Count > 0)
                {
                    lblCustomerName.Text = "<b>" + dsInvoice.Tables[1].Rows[0]["Sc_Name"].ToString() + "</b>";
                    lblAscAddress.Text   = dsInvoice.Tables[1].Rows[0]["Addres"].ToString();
                }
                if (dsInvoice.Tables[2].Rows.Count > 0)
                {
                    lblInvoiceNo.Text   = dsInvoice.Tables[2].Rows[0]["InvoiceNo"].ToString();
                    lblInvoiceDate.Text = dsInvoice.Tables[2].Rows[0]["InvoiceDt"].ToString();
                }
                if (dsInvoice.Tables[0].Rows.Count > 0)
                {
                    taxableAmt = Math.Round(Convert.ToDouble(dsInvoice.Tables[0].Compute("Sum(TaxableAmt)", "")), 2);
                }

                // callnew proc

                calculate();
            }
        }
        catch (Exception ex)
        {
            SIMSCommonClass.WriteErrorErrFile(Request.RawUrl.ToString(), ex.StackTrace.ToString() + "-->" + ex.Message.ToString());
        }
    }
    protected void InvoiceDetails()
    {
        //ClearInvoiceControl();
        UserName          = ddlSerContractor.SelectedValue;
        ProductDivisionId = 18;
        YearId            = Convert.ToInt32(Ddlyear.SelectedValue);
        if (ddlSerContractor.SelectedValue.Equals("0"))
        {
            spnSoldto.Visible = false;
        }
        if (!string.IsNullOrEmpty(ddlMonth.SelectedValue) && ddlMonth.SelectedValue != "0")
        {
            MonthId = Convert.ToInt32(ddlMonth.SelectedValue);
        }
        else
        {
            MonthId = DateTime.Now.Month;
            ddlMonth.SelectedValue = DateTime.Now.Month.ToString();
        }
        hdnRawUrl.Value = "yId=" + YearId.ToString() + "&mId=" + MonthId.ToString();

        if (!Roles.GetRolesForUser(objCommonMIS.EmpId).Any(x => (x.Contains("SC") || x.Contains("SC_SIMS"))))
        {
            AscId           = Convert.ToInt32(ddlSerContractor.SelectedValue);;
            RegionId        = Convert.ToInt32(ddlRegion.SelectedValue);
            BranchId        = Convert.ToInt32(ddlBranch.SelectedValue);
            hdnRawUrl.Value = hdnRawUrl.Value + "&arb=" + ddlSerContractor.SelectedValue + "|" + ddlRegion.SelectedValue + "|" + ddlBranch.SelectedValue;
            hdnRawUrl.Value = hdnRawUrl.Value + "&rbv=" + ddlRegion.SelectedItem.Text + "|" + ddlBranch.SelectedItem.Text;
        }
        else
        {
            //objsimsinvoice.AscId = 0;
            RegionId        = 0;
            BranchId        = 0;
            hdnRawUrl.Value = hdnRawUrl.Value + "&arb=";
            hdnRawUrl.Value = hdnRawUrl.Value + "&rbv=";
        }
        DataSet dsInvoice = GetInvoiceDetails();


        if (dsInvoice != null)
        {
            if (dsInvoice.Tables[1].Rows.Count > 0)
            {
                lblCustomerName.Text = "<b>" + dsInvoice.Tables[1].Rows[0]["Sc_Name"].ToString() + "</b>";
                lblAscAddress.Text   = dsInvoice.Tables[1].Rows[0]["Addres"].ToString();
            }
            if (dsInvoice.Tables[2].Rows.Count > 0)
            {
                lblInvoiceNo.Text   = dsInvoice.Tables[2].Rows[0]["InvoiceNo"].ToString();
                lblInvoiceDate.Text = dsInvoice.Tables[2].Rows[0]["InvoiceDt"].ToString();
            }

            if (dsInvoice.Tables[0].Rows.Count > 0)
            {
                taxableAmt = Math.Round(Convert.ToDouble(dsInvoice.Tables[0].Compute("Sum(TaxableAmt)", "")), 2);
            }

            if (dsInvoice.Tables[3].Rows.Count > 0)
            {
                int countL = 0;
                int countO = 0;
                foreach (DataRow dr in dsInvoice.Tables[3].Rows)
                {
                    if (dr["Activity"].ToString().Equals("L"))
                    {
                        countL = countL + 1;
                    }

                    if (dr["Activity"].ToString().Equals("O"))
                    {
                        countO = countO + 1;
                    }
                }
                lblRepLoQ.Text = countL.ToString();
                lblRepLoA.Text = Convert.ToString(Convert.ToDouble(countL) * Convert.ToDouble(lblRepLoU.Text));
                lblRepOoQ.Text = countO.ToString();
                lblRepOoA.Text = Convert.ToString(Convert.ToDouble(countO) * Convert.ToDouble(lblRepOoU.Text));
            }


            foreach (DataRow dr in dsInvoice.Tables[0].Rows)
            {
                if (dr["ActivityParameter_SNo"].ToString().Equals("0"))
                {
                    lblQuanityfd.Text   = dr["Quantity"].ToString();
                    lblfdUnitPrice.Text = dr["UnitPrice"].ToString();
                    lblfdamount.Text    = dr["Amount"].ToString();
                }
            }
            calculate();
        }
    }
Exemple #3
0
    protected void InvoiceDetails()
    {
        try
        {
            //ClearInvoiceControl();
            UserName          = Membership.GetUser().UserName;
            ProductDivisionId = 13;
            YearId            = Convert.ToInt32(Ddlyear.SelectedValue);
            if (ddlSerContractor.SelectedValue.Equals("0"))
            {
                spnSoldto.Visible = false;
            }
            if (!string.IsNullOrEmpty(ddlMonth.SelectedValue) && ddlMonth.SelectedValue != "0")
            {
                MonthId = Convert.ToInt32(ddlMonth.SelectedValue);
            }
            else
            {
                MonthId = DateTime.Now.Month;
                ddlMonth.SelectedValue = DateTime.Now.Month.ToString();
            }
            hdnRawUrl.Value = "yId=" + YearId.ToString() + "&mId=" + MonthId.ToString();

            if (!Roles.GetRolesForUser(objCommonMIS.EmpId).Any(x => (x.Contains("SC") || x.Contains("SC_SIMS"))))
            {
                AscId           = Convert.ToInt32(ddlSerContractor.SelectedValue);
                RegionId        = Convert.ToInt32(ddlRegion.SelectedValue);
                BranchId        = Convert.ToInt32(ddlBranch.SelectedValue);
                hdnRawUrl.Value = hdnRawUrl.Value + "&arb=" + ddlSerContractor.SelectedValue + "|" + ddlRegion.SelectedValue + "|" + ddlBranch.SelectedValue;
                hdnRawUrl.Value = hdnRawUrl.Value + "&rbv=" + ddlRegion.SelectedItem.Text + "|" + ddlBranch.SelectedItem.Text;
            }
            else
            {
                AscId           = 0;
                RegionId        = 0;
                BranchId        = 0;
                hdnRawUrl.Value = hdnRawUrl.Value + "&arb=";
                hdnRawUrl.Value = hdnRawUrl.Value + "&rbv=";
            }
            DataSet dsInvoice = GetInvoiceDetails();


            if (dsInvoice != null)
            {
                if (dsInvoice.Tables[1].Rows.Count > 0)
                {
                    lblCustomerName.Text = "<b>" + dsInvoice.Tables[1].Rows[0]["Sc_Name"].ToString() + "</b>";
                    lblAscAddress.Text   = dsInvoice.Tables[1].Rows[0]["Addres"].ToString();
                }
                if (dsInvoice.Tables[2].Rows.Count > 0)
                {
                    lblInvoiceNo.Text   = dsInvoice.Tables[2].Rows[0]["InvoiceNo"].ToString();
                    lblInvoiceDate.Text = dsInvoice.Tables[2].Rows[0]["InvoiceDt"].ToString();
                }
                if (dsInvoice.Tables[0].Rows.Count > 0)
                {
                    taxableAmt = Math.Round(Convert.ToDouble(dsInvoice.Tables[0].Compute("Sum(TaxableAmt)", "")), 2);
                }

                // callnew proc



                SqlParameter[] param =
                {
                    new SqlParameter("@UserName",           UserName),
                    new SqlParameter("@MonthId",            ddlMonth.SelectedValue),
                    new SqlParameter("@YearId",             Ddlyear.SelectedValue),
                    new SqlParameter("@type",               "INS"),
                    new SqlParameter("@ProductDivisionSno",                     13),
                };

                DataSet insdataset = objSqlDataAccessLayer.ExecuteDataset(CommandType.StoredProcedure, "GenerateInvoiceInstitutionalFan_Replica", param);



                if (insdataset.Tables[0].Rows.Count > 0)
                {
                    int countL = 0;
                    int countO = 0;
                    foreach (DataRow drs in insdataset.Tables[0].Rows)
                    {
                        if (drs["Activity"].ToString().Equals("L"))
                        {
                            countL = countL + 1;
                        }

                        if (drs["Activity"].ToString().Equals("O"))
                        {
                            countO = countO + 1;
                        }
                    }
                    lblRepLoQ.Text = countL.ToString();
                    lblRepLoA.Text = Convert.ToString(Convert.ToDouble(countL) * Convert.ToDouble(lblRepLoU.Text));
                    lblRepOoQ.Text = countO.ToString();
                    lblRepOoA.Text = Convert.ToString(Convert.ToDouble(countO) * Convert.ToDouble(lblRepOoU.Text));
                }


                foreach (DataRow dr in dsInvoice.Tables[0].Rows)
                {
                    if (dr["ActivityParameter_SNo"].ToString().Equals("0"))
                    {
                        lblQuanityfd.Text   = dr["Quantity"].ToString();
                        lblfdUnitPrice.Text = dr["UnitPrice"].ToString();
                        lblfdamount.Text    = dr["Amount"].ToString();
                    }
                }
                calculate();
            }
        }
        catch (Exception ex)
        {
            SIMSCommonClass.WriteErrorErrFile(Request.RawUrl.ToString(), ex.StackTrace.ToString() + "-->" + ex.Message.ToString());
        }
    }