private void Setinitialrow()
    {
        try
        {
            DataTable dt = new DataTable();
            DataRow   dr;
            dt.Columns.Add("#", typeof(int));
            dt.Columns.Add("ItemId", typeof(int));
            dt.Columns.Add("ItemDetailsId", typeof(int));
            dt.Columns.Add("UnitId", typeof(int));
            dt.Columns.Add("ItemCode", typeof(string));
            dt.Columns.Add("ItemName", typeof(string));
            dt.Columns.Add("ItemDesc", typeof(string));
            dt.Columns.Add("ReqQty", typeof(decimal));
            dt.Columns.Add("SuplierID", typeof(int));
            dt.Columns.Add("Unit", typeof(int));
            dt.Columns.Add("ReqByCafeteria", typeof(string));
            dt.Columns.Add("VUOM", typeof(string));
            dt.Columns.Add("AvgPurRate", typeof(decimal));
            dt.Columns.Add("OrdQty", typeof(decimal));
            dt.Columns.Add("PerVat", typeof(decimal));
            dt.Columns.Add("VAT", typeof(decimal));
            dt.Columns.Add("PerDisc", typeof(decimal));
            dt.Columns.Add("Disc", typeof(decimal));
            dt.Columns.Add("RemarkForPO", typeof(string));
            dr                   = dt.NewRow();
            dr["#"]              = 0;
            dr["ItemId"]         = 0;
            dr["ItemDetailsId"]  = 0;
            dr["UnitId"]         = 0;
            dr["ItemCode"]       = "";
            dr["ItemName"]       = "";
            dr["ItemDesc"]       = "";
            dr["ReqQty"]         = 0;
            dr["Unit"]           = 0;
            dr["SuplierID"]      = 0;
            dr["ReqByCafeteria"] = "";
            dr["VUOM"]           = "";
            dr["AvgPurRate"]     = 0;
            dr["OrdQty"]         = 0;
            dr["PerVat"]         = 0;
            dr["VAT"]            = 0;
            dr["PerDisc"]        = 0;
            dr["Disc"]           = 0;
            dr["RemarkForPO"]    = "";
            dt.Rows.Add(dr);
            ViewState["CurrentTablePO"] = dt;
            GrdReqPO.DataSource         = dt;
            GrdReqPO.DataBind();
        }

        catch (Exception ex) { throw new Exception(ex.Message); }
    }
 public void BindReportGridTextSearch(string RepCondition)
 {
     try
     {
         DataSet DsReport = new DataSet();
         DsReport = Obj_EditPO.FillGridFromSearch(RepCondition, out StrError);
         if (DsReport.Tables.Count > 0 && DsReport.Tables[0].Rows.Count > 0)
         {
             GrdReqPO.DataSource = DsReport.Tables[0];
             GrdReqPO.DataBind();
         }
         else
         {
             GrdReqPO.DataSource = null;
             GrdReqPO.DataBind();
             SetInitialRow_ReqDetails();
         }
     }
     catch (Exception ex) { throw new Exception(ex.Message); }
 }
    private void SetInitialRow_ReqDetails()
    {
        try
        {
            DataTable dt = new DataTable();
            DataRow   dr;
            dt.Columns.Add("#", typeof(int));
            dt.Columns.Add("POId", typeof(int));
            dt.Columns.Add("SuplierName", typeof(string));
            dt.Columns.Add("PONo", typeof(string));
            dt.Columns.Add("PODate", typeof(string));
            dt.Columns.Add("POAmount", typeof(string));
            dt.Columns.Add("PaymentAmount", typeof(string));
            dt.Columns.Add("RemAmount", typeof(string));
            dt.Columns.Add("ChequeNo", typeof(string));
            dt.Columns.Add("PersonName", typeof(string));
            dt.Columns.Add("Remark", typeof(string));

            dr = dt.NewRow();

            dr["#"]             = 0;
            dr["POId"]          = 0;
            dr["SuplierName"]   = "";
            dr["PONo"]          = "";
            dr["PODate"]        = "";
            dr["POAmount"]      = "";
            dr["PaymentAmount"] = "";
            dr["RemAmount"]     = "";
            dr["ChequeNo"]      = "";
            dr["PersonName"]    = "";
            dr["Remark"]        = "";

            dt.Rows.Add(dr);

            ViewState["CurrentTable"] = dt;
            GrdReqPO.DataSource       = dt;
            GrdReqPO.DataBind();
        }

        catch (Exception ex) { throw new Exception(ex.Message); }
    }
Beispiel #4
0
 public void BindReportGridMISC(string RepCondition)
 {
     try
     {
         DataSet DsReport = new DataSet();
         DsReport = Obj_EditPO.GetPurchase_OrderMISC(RepCondition, out StrError);
         if (DsReport.Tables.Count > 0 && DsReport.Tables[0].Rows.Count > 0)
         {
             GrdReqPO.DataSource = DsReport.Tables[0];
             GrdReqPO.DataBind();
         }
         else
         {
             GrdReqPO.DataSource = null;
             GrdReqPO.DataBind();
             SetInitialRow_ReqDetails();
         }
         ScriptManager.RegisterStartupScript(this, GetType(), "ShowPOP", "javascript:HidePOP();", true);
     }
     catch (Exception ex) { throw new Exception(ex.Message); }
 }
Beispiel #5
0
    private void SetInitialRow_PODetails()
    {
        try
        {
            DataTable dt = new DataTable();
            DataRow   dr;
            dt.Columns.Add("#", typeof(int));
            dt.Columns.Add("SuplierName", typeof(string));
            dt.Columns.Add("PONo", typeof(int));
            dt.Columns.Add("Location", typeof(string));
            dt.Columns.Add("PODate", typeof(string));
            dt.Columns.Add("Amount", typeof(Decimal));
            dt.Columns.Add("POStatus", typeof(string));
            dt.Columns.Add("POId", typeof(Int32));
            dt.Columns.Add("SuplierId", typeof(Int32));
            dt.Columns.Add("Remark", typeof(Int32));

            dr = dt.NewRow();

            dr["#"]           = 0;
            dr["SuplierName"] = string.Empty;
            dr["PONo"]        = 0;
            dr["Location"]    = "";
            dr["PODate"]      = DateTime.Now.ToString("dd-MMM-yyyy");
            dr["Amount"]      = 0;
            dr["POStatus"]    = "";
            dr["POId"]        = 0;
            dr["SuplierId"]   = 0;
            dr["Remark"]      = "";

            dt.Rows.Add(dr);

            ViewState["CurrentTablePO"] = dt;
            GrdReqPO.DataSource         = dt;
            GrdReqPO.DataBind();
        }

        catch (Exception ex) { throw new Exception(ex.Message); }
    }
    protected void GrdReqPO_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        try
        {
            DataTable DtEditPO = new DataTable();
            DtEditPO = (DataTable)ViewState["POCurrentTable"];
            if (DtEditPO.Rows.Count == 0)
            {
                obj_Comman.ShowPopUpMsg("No ROW Find For Perform Delete Opeation", this.Page);
                return;
            }
            else
            {
                int CurrRow = Convert.ToInt32(e.RowIndex);

                if (DtEditPO.Rows.Count > 0)
                {
                    DtEditPO.Rows[CurrRow].Delete();
                    DtEditPO.AcceptChanges();
                    if (DtEditPO.Rows.Count == 0)
                    {
                        Setinitialrow();
                        return;
                    }
                    GrdReqPO.DataSource = null;
                    GrdReqPO.DataSource = DtEditPO;
                    GrdReqPO.DataBind();
                    ViewState["POCurrentTable"] = DtEditPO;
                }
            }
        }
        catch (Exception ex)
        {
            obj_Comman.ShowPopUpMsg(ex.Message + " ..THIS ERROR OCCURED WHILE LOADING DATA.", this.Page);
        }
    }
    public void BindRequisitionGrid(string RepCondition)
    {
        try
        {
            Ds = Obj_PurchaseOrder.GetOrder(RepCondition, out StrError);
            if (Ds.Tables.Count > 0 && Ds.Tables[0].Rows.Count > 0)
            {
                GrdReqPO.DataSource = Ds.Tables[0];
                GrdReqPO.DataBind();

                for (int v = 0; v < GrdReqPO.Rows.Count; v++)
                {
                    DropDownList ddlu = (DropDownList)GrdReqPO.Rows[v].FindControl("GrdddlUOM");
                    ddlu.Enabled = false;

                    DropDownList ddlVendor = (DropDownList)GrdReqPO.Rows[v].FindControl("GrdddlVendor");
                    ddlVendor.Enabled = false;
                    TextBox GrdtxtRate = (TextBox)GrdReqPO.Rows[v].FindControl("GrdtxtRate");
                    GrdtxtRate.Enabled = false;

                    TextBox GrdtxtOrdQty = (TextBox)GrdReqPO.Rows[v].FindControl("GrdtxtOrdQty");
                    GrdtxtOrdQty.Enabled = false;


                    TextBox GrdtxtPerVAT = (TextBox)GrdReqPO.Rows[v].FindControl("GrdtxtPerVAT");
                    GrdtxtPerVAT.Enabled = false;

                    TextBox GrdtxtVAT = (TextBox)GrdReqPO.Rows[v].FindControl("GrdtxtVAT");
                    GrdtxtVAT.Enabled = false;

                    TextBox GrdtxtPerDISC = (TextBox)GrdReqPO.Rows[v].FindControl("GrdtxtPerDISC");
                    GrdtxtPerDISC.Enabled = false;

                    TextBox GrdtxtDISC = (TextBox)GrdReqPO.Rows[v].FindControl("GrdtxtDISC");
                    GrdtxtDISC.Enabled = false;


                    TextBox GrdtxtRemarkForPO = (TextBox)GrdReqPO.Rows[v].FindControl("GrdtxtRemarkForPO");
                    GrdtxtRemarkForPO.Enabled = false;
                }


                ViewState["POCurrentTable"] = Ds.Tables["Table"];
                if (Ds.Tables[1].Rows.Count > 0)
                {
                    ddlCompany.SelectedValue = Ds.Tables[1].Rows[0]["CompanyID"].ToString();
                    lblindentno.Text         = Ds.Tables[2].Rows[0]["REQNO"].ToString();
                    LBLPOTHROUGH.Text        = Ds.Tables[1].Rows[0]["UserName"].ToString();
                    txtSubTotal.Text         = Ds.Tables[1].Rows[0]["SubTotal"].ToString();
                    txtGrandTotal.Text       = Ds.Tables[1].Rows[0]["GrandTotal"].ToString();
                    txtVATAmount.Text        = Ds.Tables[1].Rows[0]["Discount"].ToString();
                    txtDiscount.Text         = Ds.Tables[1].Rows[0]["Vat"].ToString();
                    txtpodate.Text           = Convert.ToDateTime(Ds.Tables[1].Rows[0]["PODate"].ToString()).ToString("dd-MMM-yyyy");
                    txtHamaliAmt.Text        = Ds.Tables[1].Rows[0]["HamaliAmt"].ToString();
                    txtFreightAmt.Text       = Ds.Tables[1].Rows[0]["FreightAmt"].ToString();
                    txtPostageAmt.Text       = Ds.Tables[1].Rows[0]["PostageAmt"].ToString();
                    txtOtherCharges.Text     = Ds.Tables[1].Rows[0]["OtherCharges"].ToString();
                    txtpoqtno.Text           = Ds.Tables[1].Rows[0]["POQTNO"].ToString();
                    // txtquotdate.Text =Convert.ToDateTime(Ds.Tables[1].Rows[0]["POQTDATE"].ToString()).ToString("dd-MMM-yyyy");
                    txtSerTax.Text = Ds.Tables[1].Rows[0]["ServiceTaxAmt"].ToString();
                    DDLSERVICETAX.Items.FindByText(Ds.Tables[1].Rows[0]["ServiceTaxPer"].ToString()).Selected = true;
                    txtNarration.Text     = Ds.Tables[1].Rows[0]["Instruction"].ToString();
                    txtexcisedutyper.Text = Ds.Tables[1].Rows[0]["ExcisePer"].ToString();
                    txtexciseduty.Text    = Ds.Tables[1].Rows[0]["ExciseAmount"].ToString();

                    txtInstallationRemark.Text        = Ds.Tables[1].Rows[0]["InstallationRemark"].ToString();
                    txtInstallationCharge.Text        = Ds.Tables[1].Rows[0]["InstallationCharge"].ToString();
                    txtInstallationServicetax.Text    = Ds.Tables[1].Rows[0]["InstallationSerTaxPer"].ToString();
                    txtInstallationServiceAmount.Text = Ds.Tables[1].Rows[0]["InstallationSerTaxAmt"].ToString();

                    if (Convert.ToInt32(Ds.Tables[1].Rows[0]["HamaliActual"].ToString()) == 1)
                    {
                        CHKHAMALI.Checked = true;
                    }
                    if (Convert.ToInt32(Ds.Tables[1].Rows[0]["HamaliActual"].ToString()) == 0)
                    {
                        CHKHAMALI.Checked = false;
                    }

                    if (Convert.ToInt32(Ds.Tables[1].Rows[0]["FreightActual"].ToString()) == 1)
                    {
                        CHKFreightAmt.Checked = true;
                    }
                    if (Convert.ToInt32(Ds.Tables[1].Rows[0]["FreightActual"].ToString()) == 0)
                    {
                        CHKFreightAmt.Checked = false;
                    }

                    if (Convert.ToInt32(Ds.Tables[1].Rows[0]["OtherChargeActual"].ToString()) == 1)
                    {
                        CHKOtherCharges.Checked = true;
                    }
                    if (Convert.ToInt32(Ds.Tables[1].Rows[0]["OtherChargeActual"].ToString()) == 0)
                    {
                        CHKOtherCharges.Checked = false;
                    }

                    if (Convert.ToInt32(Ds.Tables[1].Rows[0]["LoadingActual"].ToString()) == 1)
                    {
                        CHKLoading.Checked = true;
                    }
                    if (Convert.ToInt32(Ds.Tables[1].Rows[0]["LoadingActual"].ToString()) == 0)
                    {
                        CHKLoading.Checked = false;
                    }
                    TXTTERMSCONDITION.Text = Ds.Tables[3].Rows[0]["TermsCondition"].ToString();
                    TXTPaymentTerms.Text   = Ds.Tables[3].Rows[0]["PaymentTerms"].ToString();
                }
                ((DropDownList)GrdReqPO.Rows[0].FindControl("GrdddlVendor")).Focus();
            }
            else
            {
                GrdReqPO.DataSource = null;
                GrdReqPO.DataBind();
                Setinitialrow();
                obj_Comman.ShowPopUpMsg("OOPS!.. Some Error Occured While Loading Data, Please Try Again Later..", this.Page);
            }
        }
        catch (Exception ex) { obj_Comman.ShowPopUpMsg("OOPS!.. Some Error Occured While Loading Data, Please Try Again Later..", this.Page); }
    }