示例#1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            TblClientAccount obj = new TblClientAccount();
            string           msg = "Client detail has been added!";

            obj.IsNew = true;
            if (!String.IsNullOrEmpty(hfSerialNo.Value))
            {
                obj.IsNew = false;
                obj       = new TblClientAccount(hfSerialNo.Value);
                msg       = "Client detail has been updated!";
            }

            obj.Clientid    = Convert.ToInt32(ddlClientName.SelectedValue);
            obj.ReciptNo    = Convert.ToInt32(txtRecieptNo.Text);
            obj.DateX       = Convert.ToDateTime(Convert.ToDateTime(txtPetrolDate.SelectedDate).ToShortDateString() + " " + getDateTime().ToString("h:mm:ss"));
            obj.VehicleNo   = txtVehicleNo.Text;
            obj.Liters      = Convert.ToDouble(txtLiters.Text);
            obj.Rate        = Convert.ToDecimal(txtRate.Text);
            obj.Amount      = Convert.ToDecimal(Convert.ToDouble(txtLiters.Text) * Convert.ToDouble(txtRate.Text));
            obj.Received    = null;
            obj.Dsicount    = Convert.ToDecimal(txtDiscount.Text);
            obj.Description = txtPetrolDescription.Text;
            obj.Save();
            lblmsg.Text = MessageBox.Show(msgDiv, msg, "alert alert-success alert-icon alert-dismissible", icon, "glyphicon glyphicon-ok-sign");
            string id = ddlClientName.SelectedValue;

            ClearInputs(Page.Controls);
            ddlClientName.SelectedValue = id;
            hfSerialNo.Value            = null;
            BindGrid(Convert.ToInt32(ddlClientName.SelectedValue));
            txtPetrolDate.SelectedDate = null;
            txtTotalAmount.Text        = string.Empty;
        }
        protected void lnkFrwdDelete_Click(object sender, EventArgs e)
        {
            int        CompanyID             = Convert.ToInt32(Session["FrCompanyID"]);
            LinkButton btn                   = (LinkButton)sender;
            TblCompanyAccountDetail objCmpAc = new TblCompanyAccountDetail(CompanyID);

            ScriptManager.GetCurrent(this).RegisterAsyncPostBackControl(btn);
            TblClientAccount.Delete(TblClientAccount.Columns.Fid, btn.CommandArgument);
            TblFarwordAmount.Delete(btn.CommandArgument);
            lblmsg2.Text = MessageBox.Show(msgDiv2, "Record has been deleted!", "alert alert-success alert-icon alert-dismissible", icon, "glyphicon glyphicon-ok-sign");
            LoadFrwdAmount(objCmpAc.SerialNo);
        }
示例#3
0
        protected void lnkDelete_Click(object sender, EventArgs e)
        {
            LinkButton       btn = (LinkButton)sender;
            TblClientAccount obj = new TblClientAccount(btn.CommandArgument);

            if (obj.Fid != null)
            {
                TblFarwordAmount.Delete(obj.Fid);
            }
            TblClientAccount.Delete(btn.CommandArgument);
            lblmsg.Text = MessageBox.Show(msgDiv, "Record has been deleted!", "alert alert-success alert-icon alert-dismissible", icon, "glyphicon glyphicon-ok-sign");
            string id = ddlClientName.SelectedValue;

            ClearInputs(Page.Controls);
            ddlClientName.SelectedValue = id;
            BindGrid(Convert.ToInt32(ddlClientName.SelectedValue));
        }
示例#4
0
        protected void lnkEdit_Click(object sender, EventArgs e)
        {
            LinkButton       btn = (LinkButton)sender;
            TblClientAccount obj = new TblClientAccount(btn.CommandArgument);

            if (String.IsNullOrEmpty(obj.Liters.ToString()) && !String.IsNullOrEmpty(obj.Amount.ToString())) //ShowPaidPopUp
            {
                txtPaidDescription.Text         = obj.Description;
                txtPaidAmmount.Text             = obj.Amount.ToString();
                txtPaidReciept.Text             = obj.ReciptNo.ToString();
                ddlPaidClientName.SelectedValue = obj.Clientid.ToString();
                txtVehiclePaid.Text             = Convert.ToString(obj.VehicleNo);
                txtPaidDate.SelectedDate        = obj.DateX;
                ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModal('#PaidformPopUp');", true);
            }
            else if (!String.IsNullOrEmpty(obj.Liters.ToString()) && !String.IsNullOrEmpty(obj.Amount.ToString()))   //MainForm
            {
                txtTotalAmount.Text       = obj.Amount.ToString();
                txtDiscount.Text          = obj.Dsicount.ToString();
                txtVehicleNo.Text         = obj.VehicleNo;
                txtPetrolDescription.Text = obj.Description;
                txtRate.Text                = obj.Rate.ToString();
                txtRecieptNo.Text           = obj.ReciptNo.ToString();
                txtLiters.Text              = obj.Liters.ToString();
                ddlClientName.SelectedValue = obj.Clientid.ToString();
                txtPetrolDate.SelectedDate  = obj.DateX;
            }
            else if (!String.IsNullOrEmpty(obj.Received.ToString())) //ShowRecievedPopUp
            {
                ddlRecievedClientName.SelectedValue = obj.Clientid.ToString();
                txtRecievdReceiptNo.Text            = obj.ReciptNo.ToString();
                txtRecivedAmmount.Text      = obj.Received.ToString();
                txtRecivedDescription.Text  = obj.Description;
                txtRecivedDate.SelectedDate = obj.DateX;
                ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModal('#RecivedformPopUp');", true);
            }
            hfSerialNo.Value = btn.CommandArgument;
        }
        protected void btnFrwrdAmount_Click(object sender, EventArgs e)
        {
            #region
            //TblFarwordAmount obj = new TblFarwordAmount();
            //TblClientAccount objClientAcount = new TblClientAccount();
            //obj.IsNew = true;
            //objClientAcount.IsNew = true;

            //DataTable dt = ExecutePlainQuery("select * from tbl_FarwordAmount where SerialNo=" + hfCompanyID.Value);

            //if (dt.Rows.Count > 0)
            //{
            //    obj.IsNew = false;
            //    objClientAcount.IsNew = false;
            //    obj = new TblFarwordAmount(TblFarwordAmount.Columns.SerialNo, hfCompanyID.Value);

            //}

            //obj.Rate = Convert.ToDouble(txtfrwrdRate.Text);
            //obj.Quantity = Convert.ToDouble(txtfrwrdQuantity.Text);
            //obj.SerialNo = Convert.ToInt32(hfCompanyID.Value);
            //obj.ClientID = Convert.ToInt32(ddlCLient.SelectedValue);
            //obj.Save();
            //TblCompanyAccountDetail objCmpAc = new TblCompanyAccountDetail(hfCompanyID.Value);
            //objClientAcount.Liters = Convert.ToDouble(obj.Quantity);
            //objClientAcount.Clientid = Convert.ToInt32(ddlCLient.SelectedValue);
            //objClientAcount.Rate = Convert.ToDecimal(txtfrwrdRate.Text);
            //objClientAcount.Description = objCmpAc.CategoryID == 1 ? "Forwaded PMG" : "Forwaded HSD";
            //objClientAcount.Amount = Convert.ToDecimal(obj.Quantity * obj.Rate);
            //objClientAcount.Fid = obj.Fid;
            //objClientAcount.DateX = objCmpAc.DateX;
            //objClientAcount.Save();
            //TblClient objClientName = new TblClient(ddlCLient.SelectedValue);
            #endregion
            int CompanyID = Convert.ToInt32(Session["FrCompanyID"]);
            int FrwdID    = Convert.ToInt32(Session["FID"]);
            TblCompanyAccountDetail objCmpAc        = new TblCompanyAccountDetail(CompanyID);
            TblFarwordAmount        obj             = new TblFarwordAmount();
            TblClientAccount        objClientAcount = new TblClientAccount();
            string msg = "Amount has been forwaded to " + ddlCLient.SelectedItem.Text;
            if (Session["FID"] != null)
            {
                obj                   = new TblFarwordAmount(FrwdID);
                obj.IsNew             = false;
                objClientAcount       = new TblClientAccount(TblClientAccount.Columns.Fid, FrwdID);
                objClientAcount.IsNew = false;
                msg                   = "Farwaded amount detail has been updated!";
            }
            obj.Rate       = Convert.ToDouble(txtfrwrdRate.Text);
            obj.Quantity   = Convert.ToDouble(txtfrwrdQuantity.Text);
            obj.SerialNo   = Convert.ToInt32(CompanyID);
            obj.ClientID   = Convert.ToInt32(ddlCLient.SelectedValue);
            obj.CategoryID = objCmpAc.CategoryID;
            obj.Save();

            objClientAcount.Liters      = Convert.ToDouble(txtfrwrdQuantity.Text);
            objClientAcount.Clientid    = Convert.ToInt32(ddlCLient.SelectedValue);
            objClientAcount.Rate        = Convert.ToDecimal(txtfrwrdRate.Text);
            objClientAcount.Description = objCmpAc.CategoryID == 1 ? "Forwaded PMG" : "Forwaded HSD";
            objClientAcount.Amount      = Convert.ToDecimal(obj.Quantity * obj.Rate);
            objClientAcount.Fid         = obj.Fid;
            objClientAcount.DateX       = Convert.ToDateTime(Convert.ToDateTime(objCmpAc.DateX).ToShortDateString() + " " + getDateTime().ToString("h:mm:ss"));
            objClientAcount.Save();
            lblmsg2.Text = MessageBox.Show(msgDiv2, msg, "alert alert-success alert-icon alert-dismissible", icon, "glyphicon glyphicon-ok-sign");
            LoadFrwdAmount(objCmpAc.SerialNo);
            Session["FID"] = null;
            //Session["CompanyID"] = null;
            ClearInputs(Controls);
        }