protected void btnget_Click(object sender, EventArgs e)
    {
        string from = txtfromDate.Text.Split('/')[2] + "/" + txtfromDate.Text.Split('/')[1] + "/" + txtfromDate.Text.Split('/')[0];
        string To   = txttoDate.Text.Split('/')[2] + "/" + txttoDate.Text.Split('/')[1] + "/" + txttoDate.Text.Split('/')[0];

        fdate = Convert.ToDateTime(from);
        tdate = Convert.ToDateTime(To);
        if (fdate > tdate)
        {
            MessageBox("From Date is Greater than ToDate");
            a.Visible = false;
            txtfromDate.Focus();
        }
        else
        {
            a.Visible = true;
            dt        = ActualInvoiceDetails.Idv_Chetana_Report_Get_DC_Confiramation(fdate, tdate, Convert.ToInt32(DDLSuperZone.SelectedValue.ToString()), Convert.ToInt32(DDLZone.SelectedValue.ToString()), Convert.ToInt32(strFY), "report", "", "").Tables[0];
            if (dt.Rows.Count != 0)
            {
                Session["dcconfirmation"] = dt;
                Bind(dt);
            }
            else
            {
                MessageBox("No Record Found");
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.QueryString["d"] != null && Request.QueryString["sd"] != null)
        {
            DataSet ds            = new DataSet();
            DataSet dsTransporter = SpecimanDetails.Get_SpecTransporterAndDetails(Convert.ToDecimal(Request.QueryString["sd"].ToString().Trim()), "approved");
            ds = SpecimanDetails.Get_SubDocId_And_ItsRecords_By_DocNo(Convert.ToInt32(Request.QueryString["d"].ToString().Trim()), "approved");
            DataView dv = new DataView(ds.Tables[1]);
            dv.RowFilter            = "SubConfirmID = " + Request.QueryString["sd"].ToString().Trim();
            DocumentNo.InnerHtml    = ds.Tables[1].Rows[0]["DocumentNo"].ToString();
            Todaydate.InnerHtml     = DateTime.Now.ToString("dd/MM/yyyy");
            Subconfirmid.InnerHtml  = Request.QueryString["sd"].ToString();
            empname.InnerHtml       = ds.Tables[2].Rows[0][0].ToString() + " " + ds.Tables[2].Rows[0][1].ToString() + " " + ds.Tables[2].Rows[0][2].ToString();
            spnaddress.InnerHtml    = ds.Tables[2].Rows[0]["Address"].ToString().ToUpper() + "</br> " + ds.Tables[2].Rows[0]["City"].ToString().ToUpper() + ", " + ds.Tables[2].Rows[0]["State"].ToString().ToUpper();
            SpInstruction.InnerHtml = ds.Tables[2].Rows[0]["SpInstruction"].ToString();
            Description.InnerHtml   = ds.Tables[2].Rows[0]["Description"].ToString();

            lbltransporter.InnerHtml = dsTransporter.Tables[0].Rows[0]["Transporter"].ToString();
            lbllrno.InnerHtml        = dsTransporter.Tables[0].Rows[0]["LrNo"].ToString();
            lblbundles.InnerHtml     = dsTransporter.Tables[0].Rows[0]["Bundles"].ToString();

            grdapproval.DataSource = dv;
            grdapproval.DataBind();
            DataSet ds1 = new DataSet();
            ds1 = ActualInvoiceDetails.GetConvertion_fromnumber(tamount);
            lblrupees.InnerHtml = ds1.Tables[0].Rows[0][0].ToString() + " Only";
        }
    }
    protected void btnget_Click(object sender, EventArgs e)
    {
        string from = txtfromDate.Text.Split('/')[2] + "/" + txtfromDate.Text.Split('/')[1] + "/" + txtfromDate.Text.Split('/')[0];
        string To   = txttoDate.Text.Split('/')[2] + "/" + txttoDate.Text.Split('/')[1] + "/" + txttoDate.Text.Split('/')[0];

        fdate = Convert.ToDateTime(from);
        tdate = Convert.ToDateTime(To);
        if (fdate > tdate)
        {
            MessageBox("From Date is Greater than ToDate");
            Checklistrpt.Visible = false;

            txtfromDate.Focus();
        }
        else
        {
            dt = ActualInvoiceDetails.Get_Invoice_OnDatechecklist(fdate, tdate).Tables[0];
            if (dt.Rows.Count != 0)
            {
                Session["list1"] = dt;
                Bind(dt);
            }
            else
            {
                MessageBox("No Record Found");
            }
        }
        //Bind(0);
    }
Esempio n. 4
0
 protected void DDLCustomer_SelectedIndexChanged(object sender, EventArgs e)
 {
     ddldocno.Items.Clear();
     //ddldocno.DataSource = ActualInvoiceDetails.GetCustomer_OnView(Convert.ToInt32(DDLCustomer.SelectedValue), "EditDC")
     ddldocno.DataSource = ActualInvoiceDetails.GetCustomer_OnView(Convert.ToInt32(DDLCustomer.SelectedValue), "EditDC", Convert.ToInt32(strFY));
     ddldocno.DataBind();
     ddldocno.Items.Insert(0, new ListItem("-Select Docno-", "0"));
     ddldocno.Focus();
 }
    protected void DDLCustomer_SelectedIndexChanged(object sender, EventArgs e)
    {
        Rptrpending.DataSource = ActualInvoiceDetails.GetCustomer_OnView(Convert.ToInt32(DDLCustomer.SelectedValue), "EditInvoice", Convert.ToInt32(strFY));
        Rptrpending.DataBind();
        //   Panel1.Visible = true;
        upDocNo.Update();
        Panel1.Visible      = true;
        Rptrpending.Visible = true;

        //pnldetails.Visible = false;
        // RepDetailsConfirm.DataSource = null;
        // RepDetailsConfirm.DataBind();
        // updategenerate.Update();
    }
Esempio n. 6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.QueryString["d"] != null && Request.QueryString["sd"] != null)
        {
            DataSet ds = new DataSet();
            ds = DCDetails.Get_SubDocId_And_ItsRecords_By_DocNo(Convert.ToInt32(Request.QueryString["d"].ToString().Trim()), "approved");
            DataView dv = new DataView(ds.Tables[1]);
            dv.RowFilter = "SubConfirmID =" + Request.QueryString["sd"].ToString().Trim();
            // DocumentNo.InnerHtml = ds.Tables[1].Rows[0]["DocumentNo"].ToString();


            orderno.InnerHtml      = ds.Tables[2].Rows[0]["OrderNo"].ToString();
            Todaydate.InnerHtml    = DateTime.Now.ToString("dd/MM/yyyy");
            Subconfirmid.InnerHtml = Request.QueryString["sd"].ToString();
            custname.InnerHtml     = ds.Tables[2].Rows[0]["CustName"].ToString() + ",";
            custadd.InnerHtml      = ds.Tables[2].Rows[0]["Address"].ToString().Replace(",", ",<br/>") + "  </br>  "
                                     + ds.Tables[2].Rows[0]["City"].ToString() + ", " + ds.Tables[2].Rows[0]["State1"].ToString();
            spnaddress.InnerHtml = ds.Tables[2].Rows[0]["Zip"].ToString();

            lblpersonincharge.InnerHtml = ds.Tables[2].Rows[0]["PIncharge"].ToString();
            // lbldate.InnerHtml =          ds.Tables[2].Rows[0]["PIncharge"].ToString()  ;
            LBLBUNDLES.InnerHtml     = ds.Tables[1].Rows[0]["Bundles"].ToString();
            lbltransporter.InnerHtml = ds.Tables[1].Rows[0]["Transporter"].ToString();
            lrno.InnerHtml           = ds.Tables[1].Rows[0]["LRNo"].ToString();
            grdapproval.DataSource   = dv;
            grdapproval.DataBind();

            DataView dv1 = new DataView(ds.Tables[3]);
            dv1.RowFilter = "SubConfirmID = " + Request.QueryString["sd"].ToString().Trim();
            if (dv1.Count > 0)
            {
                lblfreight.InnerHtml = dv1[0].Row["Freight"].ToString();
                lbltax.InnerHtml     = dv1[0].Row["Tax"].ToString();
                decimal frt = Convert.ToDecimal(dv1[0].Row["Freight"].ToString());
                decimal tx  = Convert.ToDecimal(dv1[0].Row["Tax"].ToString());
                tamt = frt + tx + totalamount;
                Lbltotalamt.InnerHtml = tamt.ToString();
            }
            else
            {
                lblfreight.InnerHtml  = "0";
                lbltax.InnerHtml      = "0";
                Lbltotalamt.InnerHtml = totalamount.ToString();
            }
            DataSet ds1 = new DataSet();
            ds1 = ActualInvoiceDetails.GetConvertion_fromnumber(tamt);
            lblrupees.InnerHtml = ds1.Tables[0].Rows[0][0].ToString() + " Only";
        }
    }
    protected void grdapproval_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        // Repeater objrep = ((Repeater)this.FindControl("RepDetailsConfirm"));
        // RepeaterCommandEventArgs s = (RepeaterCommandEventArgs)(e);
        // decimal subdoc = Convert.ToDecimal((s.CommandArgument.ToString().Trim()));
        GridView             objgrid1    = (GridView)(sender);
        ActualInvoiceDetails _objinvoice = new ActualInvoiceDetails();

        invoiceId = Convert.ToInt32(((Label)objgrid1.Rows[e.RowIndex].FindControl("lblgenerateinvoiceid")).Text);

        try
        {
            if (invoiceId != 0)
            {
                _objinvoice.GanerateinvoiceId = invoiceId;
                _objinvoice.IsActive          = false;
                _objinvoice.IsDeleted         = true;
                _objinvoice.SubDocId          = Convert.ToDecimal(((Label)objgrid1.Parent.FindControl("SubConfirmID")).Text);

                decimal amt1     = Convert.ToDecimal(((Label)objgrid1.Rows[e.RowIndex].FindControl("lblamt")).Text);
                decimal amount1  = Convert.ToDecimal(((Label)objgrid1.Parent.FindControl("lblallTotalamt")).Text);
                decimal tamount1 = amount1 - amt1;
                _objinvoice.TotalAmount       = tamount1;
                _objinvoice.FinancialYearFrom = strFY.ToString();
                if (objgrid1.Rows.Count == 1)
                {
                    _objinvoice.flag = "DeleteInvoice" + "!" + Session["UserName"].ToString();
                }
                else
                {
                    _objinvoice.flag = "invoice";
                }
                _objinvoice.DeleteActual_InvoiceDetails(1);
            }

            stDS            = new DataSet();
            docno.InnerHtml = txtDocno.Text.Trim();
            stDS            = DCDetails.Get_SubDocId_And_ItsRecords_By_DocNo(Convert.ToInt32(txtDocno.Text), "Edit", Convert.ToInt32(strFY));
            RepDetailsConfirm.DataSource = stDS.Tables[0];
            RepDetailsConfirm.DataBind();
        }
        catch
        {
        }
    }
Esempio n. 8
0
    public void ShowDetails()
    {
        string from = txtfromDate.Text.Split('/')[2] + "/" + txtfromDate.Text.Split('/')[1] + "/" + txtfromDate.Text.Split('/')[0];
        string To   = txttoDate.Text.Split('/')[2] + "/" + txttoDate.Text.Split('/')[1] + "/" + txttoDate.Text.Split('/')[0];

        fdate = Convert.ToDateTime(from);
        tdate = Convert.ToDateTime(To);

        if (fdate > tdate)
        {
            MessageBox("From Date is Greater than ToDate");
            txtfromDate.Focus();
        }
        else
        {
            DataSet dsop = new DataSet();
            dsop = ActualInvoiceDetails.Get_Bank_Ledger(txtBank.Text.ToString().Trim(), "OpeningBalance", from, 0, 0, Convert.ToInt32(strFY));
            decimal ob;
            ob = Convert.ToDecimal(dsop.Tables[1].Rows[0]["OpeningBlance"].ToString());

            DataSet ds = new DataSet();
            ds = ActualInvoiceDetails.Get_Bank_Ledger(txtBank.Text.ToString().Trim(), from, To, ob, 0, 0);

            DataView       dv = new DataView(ds.Tables[0]);
            ReportDocument rd = new ReportDocument();
            rd.Load(Server.MapPath("Report/BankLedgerNew.rpt"));
            //rd.Load(Server.MapPath("Report/BankLedger.rpt"));
            rd.Database.Tables[0].SetDataSource(dv);
            BankLedger.ReportSource = rd;

            //gvBankLedger.DataSource = ActualInvoiceDetails.Get_Bank_Ledger(txtBank.Text.ToString().Trim(), from, To).Tables[0];
            // gvBankLedger.DataBind();
            //if (gvBankLedger.Rows.Count <= 0)
            //{
            //    MessageBox("No Record Found");
            //}
        }
    }
Esempio n. 9
0
    protected void RepDetailsConfirm_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        if (Session["saved"] == null)
        {
            Session["saved"] = "s";
        }

        if (Session["saved"].ToString() != e.CommandArgument.ToString().Trim())
        {
            //if (e.CommandName == "AddToCart")
            {
                bool Auth = DCMaster.Get_DocumentNum_Authentication(Convert.ToInt32(txtDocno.Text), Convert.ToInt32(strFY));
                if (Auth)
                {
                    MessageBox("Document no is not available");
                    txtDocno.Focus();
                }
                else
                {
                    DCConfirmQtyDetails  _objDCConfirmQtyDetails = new DCConfirmQtyDetails();
                    DCMaster             _objDCMaster            = new DCMaster();
                    DCConfirmQtyDetails  _objDCFT          = new DCConfirmQtyDetails();
                    ActualInvoiceDetails _objactualinvoice = new ActualInvoiceDetails();

                    try
                    {
                        #region ActulInvoice
                        Repeater objrep  = (Repeater)this.FindControl("RepDetailsConfirm");
                        GridView objgrid = (GridView)objrep.Items[e.Item.ItemIndex].FindControl("grdapproval");

                        foreach (GridViewRow row in objgrid.Rows)
                        {
                            _objactualinvoice.DocumentNo        = Convert.ToInt32(txtDocno.Text);
                            _objactualinvoice.SubDocId          = Convert.ToDecimal(e.CommandArgument.ToString().Trim());
                            _objactualinvoice.BookCode          = ((Label)row.FindControl("lblbookC")).Text;
                            _objactualinvoice.BookName          = ((Label)row.FindControl("lblbookN")).Text;
                            _objactualinvoice.Standard          = ((Label)row.FindControl("lblStandard")).Text;
                            _objactualinvoice.Medium            = ((Label)row.FindControl("lblMedium")).Text;
                            _objactualinvoice.Rate              = Convert.ToDecimal(((TextBox)row.FindControl("txtrate")).Text);
                            _objactualinvoice.Quantity          = Convert.ToInt32(((Label)row.FindControl("lblAqty")).Text);
                            _objactualinvoice.Discount          = Convert.ToDecimal(((TextBox)row.FindControl("txtdiscount")).Text);
                            _objactualinvoice.Amount            = Convert.ToInt32(((Label)row.FindControl("lblAqty")).Text) * (Convert.ToDecimal(((TextBox)row.FindControl("txtrate")).Text) - (Convert.ToDecimal(((TextBox)row.FindControl("txtrate")).Text) * Convert.ToDecimal(((TextBox)row.FindControl("txtdiscount")).Text) / 100));
                            _objactualinvoice.Freight           = Convert.ToDecimal(((TextBox)e.Item.FindControl("txtfrieght")).Text);
                            _objactualinvoice.Tax               = Convert.ToDecimal(((TextBox)e.Item.FindControl("txttax")).Text);
                            _objactualinvoice.Transporter       = (((TextBox)e.Item.FindControl("lbltransporter")).Text);
                            _objactualinvoice.LRNo              = (((TextBox)e.Item.FindControl("txtlrno")).Text);
                            _objactualinvoice.TotalAmount       = Convert.ToDecimal(getTotalValues(objgrid).ToString()) + Convert.ToDecimal(((TextBox)e.Item.FindControl("txtfrieght")).Text) + Convert.ToDecimal(((TextBox)e.Item.FindControl("txttax")).Text);
                            _objactualinvoice.Bundles           = (((TextBox)e.Item.FindControl("txtbundles")).Text);
                            _objactualinvoice.CreatedBy         = Convert.ToString(Session["UserName"]);
                            _objactualinvoice.FinancialYearFrom = strFY;

                            TextBox txtIdate1  = ((TextBox)e.Item.FindControl("txtdateabc"));
                            TextBox txtLrdate1 = ((TextBox)e.Item.FindControl("txtlrdate"));
                            _objactualinvoice.IsActive  = true;
                            _objactualinvoice.IsDeleted = false;
                            string date1;
                            string lrdate;
                            if (txtIdate1.Text == "")
                            {
                                date1 = "1/1/2001";
                            }
                            else
                            {
                                date1 = txtIdate1.Text.Split('/')[2] + "/" + txtIdate1.Text.Split('/')[1] + "/" + txtIdate1.Text.Split('/')[0];
                            }
                            if (txtLrdate1.Text == "")
                            {
                                lrdate = "1/1/2001";
                            }
                            else
                            {
                                lrdate = txtLrdate1.Text.Split('/')[2] + "/" + txtLrdate1.Text.Split('/')[1] + "/" + txtLrdate1.Text.Split('/')[0];
                            }
                            _objactualinvoice.InvoiceDate = Convert.ToDateTime(date1);

                            _objactualinvoice.LRDate  = Convert.ToDateTime(lrdate);
                            _objactualinvoice.Remark1 = "";
                            _objactualinvoice.Remark2 = "";
                            _objactualinvoice.Remark3 = "";
                            _objactualinvoice.SaveActual_InvoiceDetails(1);
                            // (TextBox)e.Item.FindControl("txtfrieght");
                        }

                        #endregion

                        #region InvoiceCreate
                        decimal subconfirmdoc = Convert.ToDecimal(e.CommandArgument.ToString().Trim());
                        _objDCConfirmQtyDetails.IsCreateInvoice  = true;
                        _objDCConfirmQtyDetails.CreatedInvoiceBy = Convert.ToString(Session["UserName"]);
                        _objDCConfirmQtyDetails.SubDocNo         = subconfirmdoc;
                        // For financial year
                        _objDCConfirmQtyDetails.AvailableQty = Convert.ToInt32(strFY);
                        _objDCMaster.DocNo = Convert.ToInt32(txtDocno.Text);

                        // Save Freight and tax Details
                        frieght     = Convert.ToDecimal(((TextBox)e.Item.FindControl("txtfrieght")).Text);
                        tax         = Convert.ToDecimal(((TextBox)e.Item.FindControl("txttax")).Text);
                        temp        = Convert.ToDecimal(tamount.Text) + frieght + tax;
                        totalamount = Convert.ToDecimal(tamount.Text);

                        _objDCFT.DocumentNo = Convert.ToInt32(txtDocno.Text);
                        _objDCFT.SubDocNo   = subconfirmdoc;
                        _objDCFT.Freight    = Convert.ToDecimal(((TextBox)e.Item.FindControl("txtfrieght")).Text);
                        _objDCFT.Tax        = Convert.ToDecimal(((TextBox)e.Item.FindControl("txttax")).Text);
                        decimal TotalAmt = Convert.ToDecimal(getTotalValues(objgrid).ToString()) + Convert.ToDecimal(((TextBox)e.Item.FindControl("txtfrieght")).Text) + Convert.ToDecimal(((TextBox)e.Item.FindControl("txttax")).Text);
                        _objDCFT.TotalAmount = Convert.ToDecimal(getTotalValues(objgrid).ToString()) + Convert.ToDecimal(((TextBox)e.Item.FindControl("txtfrieght")).Text) + Convert.ToDecimal(((TextBox)e.Item.FindControl("txttax")).Text);
                        _objDCFT.LRNo        = (((TextBox)e.Item.FindControl("txtlrno")).Text);
                        TextBox txtIdate = ((TextBox)e.Item.FindControl("txtdateabc"));
                        string  date;
                        if (txtIdate.Text == "")
                        {
                            date = "1/1/2001";
                        }
                        else
                        {
                            date = txtIdate.Text.Split('/')[2] + "/" + txtIdate.Text.Split('/')[1] + "/" + txtIdate.Text.Split('/')[0];
                        }
                        _objDCFT.InvoiceDate  = Convert.ToDateTime(date);
                        _objDCFT.AvailableQty = Convert.ToInt32(strFY);
                        _objDCFT.Save_FrightTax_Details(1);


                        _objDCConfirmQtyDetails.SaveConfirmDetails(1);

                        stDS            = new DataSet();
                        docno.InnerHtml = txtDocno.Text.Trim();
                        // stDS = DCDetails.Get_SubDocId_And_ItsRecords_By_DocNo(Convert.ToInt32(txtDocno.Text), "confirmed", Convert.ToInt32(strFY));

                        //if (ViewState["staticDS"] != null)
                        //{
                        //    stDS = (DataSet)ViewState["staticDS"];
                        //}
                        //else
                        //{
                        stDS = DCDetails.Get_SubDocId_And_ItsRecords_By_DocNo(Convert.ToInt32(txtDocno.Text), "confirmed", Convert.ToInt32(strFY));

                        //}


                        RepDetailsConfirm.DataSource = stDS.Tables[0];
                        RepDetailsConfirm.DataBind();
                        #endregion

                        MessageBox("Invoice created successfully " + subconfirmdoc);

                        lblmessage.InnerHtml = "Last confirm doc no. : " + subconfirmdoc;

                        if (Rptrpending.Items.Count == 1)
                        {
                            Rptrpending.DataSource = DCMaster.Get_ApprovedDocNo(Convert.ToInt32(strFY));
                            Rptrpending.DataBind();
                            //updateapprove.Update();
                        }
                        if (RepDetailsConfirm.Items.Count == 0)
                        {
                            Rptrpending.DataSource = DCMaster.Get_ApprovedDocNo(Convert.ToInt32(strFY));
                            Rptrpending.DataBind();
                            upDocNo.Update();
                            docno.InnerHtml       = "";
                            lblcustname.InnerHtml = "";
                            lblempname1.InnerHtml = "";
                            //updateapprove.Update();
                        }
                        if (SMSSend.Text.ToUpper() == "YES")
                        {
                            sendMsg(lblMobNo.Text.Trim(), subconfirmdoc.ToString(), string.Format("{0:0.00}", TotalAmt).ToString(),
                                    (((TextBox)e.Item.FindControl("lbltransporter")).Text),
                                    (((TextBox)e.Item.FindControl("txtlrno")).Text),
                                    (((TextBox)e.Item.FindControl("txtbundles")).Text),
                                    txtIdate.Text.Trim());


                            //sendZoalMsg(((Label)e.Item.FindControl("lblCustId1")).Text, lblcustname.InnerHtml.Trim(), lblMobNo.Text.Trim(), subconfirmdoc.ToString(), string.Format("{0:0.00}", TotalAmt).ToString(),
                            //    (((TextBox)e.Item.FindControl("lbltransporter")).Text),
                            //    (((TextBox)e.Item.FindControl("txtlrno")).Text),
                            //    (((TextBox)e.Item.FindControl("txtbundles")).Text),
                            //    txtIdate.Text.Trim());
                        }
                        //lblempname1.InnerHtml = "";
                        //lblcustname.InnerHtml = "";
                        // docno.InnerHtml = "" ;
                    }
                    catch (SqlException ex)
                    {
                        Response.Write(ex.Message.ToString());
                    }
                    catch (Exception ex1)
                    {
                        Response.Write(ex1.Message.ToString());
                    }
                }
            }
        }

        ViewState["staticDS"] = null;
        Session["saved"]      = e.CommandArgument.ToString().Trim();
        updategenerate.Update();
    }