protected void btnget_Click(object sender, EventArgs e)
    {
        string   FromDate1 = txtfromdate.Text.Split('/')[1] + "/" + txtfromdate.Text.Split('/')[0] + "/" + txtfromdate.Text.Split('/')[2];
        string   ToDate1   = txttodate.Text.Split('/')[1] + "/" + txttodate.Text.Split('/')[0] + "/" + txttodate.Text.Split('/')[2];
        DateTime FromDate  = Convert.ToDateTime(FromDate1);
        DateTime ToDate    = Convert.ToDateTime(ToDate1);

        if (txtinvoice.Text.Trim() == "")
        {
            txtinvoice.Text = "0";
        }

        int     InvoiceNo    = Convert.ToInt32(txtinvoice.Text.Trim());
        DataSet viewpurchase = new DataSet();

        viewpurchase = PurchaseMaster.Get_PurchaseDetails(InvoiceNo, FromDate, ToDate);
        if (viewpurchase.Tables[0].Rows.Count != 0)
        {
            grdpurchaseDetails.DataSource = viewpurchase;
            grdpurchaseDetails.DataBind();
            grdpurchaseDetails.Visible = true;
        }
        else
        {
            message("No Record found");
            grdpurchaseDetails.Visible = true;
        }
    }
Beispiel #2
0
    public void fillData(bool callNew)
    {
        try
        {
            Report.Visible = true;
            month          = Convert.ToInt32(hidMonth.Value);
            year           = Convert.ToInt32(hidYear.Value);
            if (Session["FY"] != null)
            {
                fyear = Convert.ToInt32(Session["FY"].ToString());
            }
            else
            {
                Session.Clear();
            }


            dt = new DataTable();
            if (callNew == true)
            {
                dt = PurchaseMaster.Get_PurchaseDetails(0, System.DateTime.Now, System.DateTime.Now
                                                        , fyear, hidflag.Value, month, year).Tables[0];
                ViewState["purstate"] = dt;
            }
            else
            {
                dt = (DataTable)ViewState["purstate"];
            }


            ReportDocument crystalReport = new ReportDocument();
            if (hidflag.Value.ToLower() == "details" || hidflag.Value.ToLower() == "details_b" || hidflag.Value.ToLower() == "details_o")
            {
                if (hidflag.Value.ToLower() == "details_o")
                {
                    crystalReport.Load(Server.MapPath("Report/Purchase_Details_Vat.rpt"));
                }
                else
                {
                    crystalReport.Load(Server.MapPath("Report/Purchase_Details.rpt"));
                }
            }

            else
            {
                crystalReport.Load(Server.MapPath("~/Report/Purchase_Summery.rpt"));
            }

            crystalReport.SetDataSource(dt);
            crtcustomer.ReportSource = crystalReport;
        }
        catch (Exception ex)
        {
        }
    }
Beispiel #3
0
    protected void btnget_Click(object sender, EventArgs e)
    {
        try
        {
            string FromDate1 = "01/01/1999";
            string ToDate1   = "03/31/2099";
            if (txtfromdate.Text == "" || txttodate.Text == "")
            {
                FromDate1 = "01/01/1999";
                ToDate1   = "03/31/2099";
            }
            else
            {
                FromDate1 = txtfromdate.Text.Split('/')[1] + "/" + txtfromdate.Text.Split('/')[0] + "/" + txtfromdate.Text.Split('/')[2];
                ToDate1   = txttodate.Text.Split('/')[1] + "/" + txttodate.Text.Split('/')[0] + "/" + txttodate.Text.Split('/')[2];
            }


            DateTime FromDate = Convert.ToDateTime(FromDate1);
            DateTime ToDate   = Convert.ToDateTime(ToDate1);
            if (txtinvoice.Text.Trim() == "")
            {
                txtinvoice.Text = "0";
            }

            int InvoiceNo = Convert.ToInt32(txtinvoice.Text.Trim());

            DataTable dt = new DataTable();
            dt = PurchaseMaster.Get_PurchaseDetails(InvoiceNo, FromDate, ToDate
                                                    , Convert.ToInt32(strFY), "ACINDIVIDUAL", 0, 0).Tables[0];
            ReportDocument crystalReport = new ReportDocument();

            if (dt.Rows.Count != 0)
            {
                crystalReport.Load(Server.MapPath("Report/Purchase_Details_Vat.rpt"));
                crystalReport.SetDataSource(dt);
                repPurchaseMasterView.ReportSource = crystalReport;
            }
            else
            {
                MessageBox("No Record found");
                txtfromdate.Focus();
                txtfromdate.Text = "";
                txttodate.Text   = "";
            }
            txtfromdate.Focus();
        }
        catch (Exception ex)
        {
            MessageBox(ex.Message + "(No Record found)");
        }
    }
    protected void BtnGetDCDetails_Click(object sender, EventArgs e)
    {
        //ModalPopUpDocNum.Hide();
        //Session["tempDCData"] = null;

        int DocNum = Convert.ToInt32(TxtDocNo.Text.Trim());


        DataTable dt = new DataTable();

        dt = PurchaseMaster.Get_PurchaseDetails(DocNum, Convert.ToDateTime("2011/01/01"), Convert.ToDateTime("2011/01/01")
                                                , Convert.ToInt32(strFY), "ACEDIT", 0, 0).Tables[0];

        if (dt.Rows.Count > 0)
        {
            lblshow.Text      = dt.Rows[0]["SuppliersRef"].ToString();
            txtSupplier.Text  = dt.Rows[0]["SuppliersRefCode"].ToString();
            txtPurchase.Text  = dt.Rows[0]["PurchaseCode"].ToString();
            lblpurchase.Text  = dt.Rows[0]["PurchaseName"].ToString();
            txtDate.Text      = dt.Rows[0]["InvoiceDate"].ToString();
            txtInvoiceNo.Text = dt.Rows[0]["InvoiceNo"].ToString();
            lblID.Text        = dt.Rows[0]["PurchaseMasterID"].ToString();

            try
            {
                //txtPercentage.Text = dt.Rows[0]["vat"].ToString();
                txtVatAmt.Text         = dt.Rows[0]["vat"].ToString();
                ddlmsoms.SelectedValue = dt.Rows[0]["ms_oms"].ToString();
                ddlVat.SelectedValue   = dt.Rows[0]["vat"].ToString();
                txtremark.Text         = dt.Rows[0]["remark"].ToString();
            }
            catch (Exception ex)
            {
            }
            gvPurchasing.DataSource = dt;
            gvPurchasing.DataBind();
            Session["tempdata"] = dt;
            btn_Save.Visible    = true;
            txtCode.Text        = "MIS";
            txtQuantity.Text    = "1";
            txtRate.Focus();
        }
        else
        {
            message("Record not found for document no. " + TxtDocNo.Text);
            ModalPopUpDocNum.Show();
            TxtDocNo.Text = "";
            TxtDocNo.Focus();
            btn_Save.Visible = false;
        }
    }
    protected void BtnGetDCDetails_Click(object sender, EventArgs e)
    {
        //ModalPopUpDocNum.Hide();
        //Session["tempDCData"] = null;

        int DocNum = Convert.ToInt32(TxtDocNo.Text.Trim());

        Session["purDocNo"] = TxtDocNo.Text.Trim();

        DataTable dt = new DataTable();

        dt = PurchaseMaster.Get_PurchaseDetails(DocNum, Convert.ToDateTime("2011/01/01"), Convert.ToDateTime("2011/01/01")
                                                , Convert.ToInt32(strFY), "EDIT", 0, 0).Tables[0];

        if (dt.Rows.Count > 0)
        {
            lblshow.Text      = dt.Rows[0]["SuppliersRef"].ToString();
            txtSupplier.Text  = dt.Rows[0]["SuppliersRefCode"].ToString();
            txtPurchase.Text  = dt.Rows[0]["PurchaseCode"].ToString();
            lblpurchase.Text  = dt.Rows[0]["PurchaseName"].ToString();
            txtDate.Text      = dt.Rows[0]["InvoiceDate"].ToString();
            txtInvoiceNo.Text = dt.Rows[0]["InvoiceNo"].ToString();
            lblID.Text        = dt.Rows[0]["PurchaseMasterID"].ToString();

            gvPurchasing.DataSource = dt;
            gvPurchasing.DataBind();
            Session["tempdata"] = dt;
        }
        else
        {
            message("Record not found for document no. " + TxtDocNo.Text);
            ModalPopUpDocNum.Show();
            TxtDocNo.Text = "";
            TxtDocNo.Focus();
            btn_Save.Visible = false;
        }
    }
    protected void gvPurchasing_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        PurchaseDetails _objdcd = new PurchaseDetails();

        purchaseDid = Convert.ToInt32(((Label)gvPurchasing.Rows[e.RowIndex].FindControl("lblpdetailid")).Text);


        try
        {
            if (purchaseDid != 0)
            {
                _objdcd.PurchaseDetailId = purchaseDid;
                _objdcd.IsActive         = false;
                _objdcd.Isdeleted        = true;
                _objdcd.Amount           = 0;
                _objdcd.Rate             = 0;
                _objdcd.Discount         = 0;
                _objdcd.Quantity         = Convert.ToInt32(((TextBox)gvPurchasing.Rows[e.RowIndex].FindControl("lblQuantity")).Text);
                _objdcd.UpdatedBy        = Session["UserName"].ToString();
                _objdcd.Delete();
            }
            DataTable dt1 = new DataTable();
            string    DocNumber;
            DocNumber = Session["purDocNo"].ToString();
            dt1       = PurchaseMaster.Get_PurchaseDetails(Convert.ToInt32(DocNumber), Convert.ToDateTime("2011/01/01"), Convert.ToDateTime("2011/01/01")
                                                           , Convert.ToInt32(strFY), "EDIT", 0, 0).Tables[0];

            // dt1 = (DataTable)Session["tempdata"];
            // dt1.Rows[e.RowIndex].Delete();
            gvPurchasing.DataSource = dt1;
            gvPurchasing.DataBind();
            Session["tempdata"] = dt1;
        }
        catch
        {
        }
    }
Beispiel #7
0
 public void BindDashBoard(string flag)
 {
     gvPurchasingDashBoard.DataSource = PurchaseMaster.Get_PurchaseDetails(0, System.DateTime.Now, System.DateTime.Now
                                                                           , Convert.ToInt32(strFY), flag, 0, 0);
     gvPurchasingDashBoard.DataBind();
 }