private void Clear()
        {
            ViewState["dt"] = null;
            dtTemp          = null;
            hidid.Value     = string.Empty; hidOwnerId.Value = string.Empty;

            ddlTruckNo.SelectedValue   = "0";
            txtOwnrNme.Text            = "";
            txtDate.Text               = "";
            txtchallanNo.Text          = "";
            ddldateRange.SelectedIndex = 0;;

            BindGridT();

            ddldateRange.Enabled       = true;
            ddldateRange.SelectedIndex = 0;

            ChlnBookingDAL objChlnBookingDAL = new ChlnBookingDAL();
            tblUserPref    obj = objChlnBookingDAL.selectUserPref();

            if (obj != null)
            {
                hidWorkType.Value = Convert.ToString(obj.Work_Type);
            }
            lnkbtnSave.Enabled = true;
        }
Esempio n. 2
0
        private string GetMsg(long iTrackIdno)
        {
            ChlnBookingDAL obj = new ChlnBookingDAL();
            String         SMS = obj.CreateSMSByTrackIdno(ApplicationFunction.ConnectionString(), iTrackIdno);

            return(SMS);
        }
Esempio n. 3
0
        private string GetMobileNumbers(Int64 iTrackIdno)
        {
            ChlnBookingDAL obj         = new ChlnBookingDAL();
            String         strMobileNo = obj.GetPartyMobileNoByTrackIdno(ApplicationFunction.ConnectionString(), iTrackIdno);

            return(strMobileNo);
        }
 protected void grdMain_RowDataBound(object sender, GridViewRowEventArgs e)
 {
     try
     {
         double dblChallanAmnt = 0;
         if (e.Row.RowType == DataControlRowType.DataRow)
         {
             //LinkButton lnkbtnDelete = (LinkButton)e.Row.FindControl("lnkbtnDelete");
             ChlnBookingDAL obj      = new ChlnBookingDAL();
             Int64          ChlnIdno = Convert.ToInt64(DataBinder.Eval(e.Row.DataItem, "Chln_Idno"));
             string         GRType   = Convert.ToString(DataBinder.Eval(e.Row.DataItem, "Gr_Type"));
             obj             = null;
             dblChallanAmnt  = Convert.ToDouble(DataBinder.Eval(e.Row.DataItem, "Net_Amnt"));
             dblTChallanAmnt = dblChallanAmnt + dblTChallanAmnt;
         }
         else if (e.Row.RowType == DataControlRowType.Footer)
         {
             Label lblTChallanAmnt = (Label)e.Row.FindControl("lblNetAmnt");
             lblTChallanAmnt.Text = dblTChallanAmnt.ToString("N2");
         }
     }
     catch (Exception ex)
     {
         throw;
     }
 }
        private void BindGrid()
        {
            ChlnBookingDAL objChlnBookingDAL = new ChlnBookingDAL();
            tblUserPref    obj = objChlnBookingDAL.selectUserPref();

            grdMain.DataSource = (DataTable)ViewState["dt"];
            grdMain.DataBind();
        }
Esempio n. 6
0
        protected void grdMain_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            try
            {
                double dblChallanAmnt = 0;
                if (e.Row.RowType == DataControlRowType.DataRow)
                {
                    //LinkButton lnkbtnDelete = (LinkButton)e.Row.FindControl("lnkbtnDelete");
                    ChlnBookingDAL obj      = new ChlnBookingDAL();
                    Int64          ChlnIdno = Convert.ToInt64(DataBinder.Eval(e.Row.DataItem, "Chln_Idno"));
                    string         GRType   = Convert.ToString(DataBinder.Eval(e.Row.DataItem, "Gr_Type"));
                    if ((obj.CheckBilled(ChlnIdno, ApplicationFunction.ConnectionString(), GRType)) > 0)
                    {
                        LinkButton lnkbtnDelete = (LinkButton)e.Row.FindControl("lnkbtnDelete");
                        lnkbtnDelete.Visible = false;
                        e.Row.ForeColor      = System.Drawing.Color.Maroon;
                    }

                    if (ChlnIdno > 0)
                    {
                        var        ChlnExist    = obj.CheckItemExistInOtherMaster(Convert.ToInt32(ChlnIdno));
                        LinkButton lnkbtnDelete = (LinkButton)e.Row.FindControl("lnkbtnDelete");
                        if (ChlnExist != null && ChlnExist.Count > 0)
                        {
                            lnkbtnDelete.Visible = false;
                        }
                        else
                        {
                            if (base.CheckUserRights(intFormId) == false)
                            {
                                Response.Redirect("PermissionDenied.aspx");
                            }
                            if (base.Delete == false)
                            {
                                lnkbtnDelete.Visible = false;
                            }
                            else
                            {
                                lnkbtnDelete.Visible = true;
                            }
                        }
                    }

                    obj             = null;
                    dblChallanAmnt  = Convert.ToDouble(DataBinder.Eval(e.Row.DataItem, "Net_Amnt"));
                    dblTChallanAmnt = dblChallanAmnt + dblTChallanAmnt;
                }
                else if (e.Row.RowType == DataControlRowType.Footer)
                {
                    Label lblTChallanAmnt = (Label)e.Row.FindControl("lblNetAmnt");
                    lblTChallanAmnt.Text = dblTChallanAmnt.ToString("N2");
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Esempio n. 7
0
        private void Trantype()
        {
            ChlnBookingDAL obj = new ChlnBookingDAL();
            var            lst = obj.BindTrantype();

            ddlTranstype.DataSource     = lst;
            ddlTranstype.DataTextField  = "Tran_Name";
            ddlTranstype.DataValueField = "Tran_Idno";
            ddlTranstype.DataBind();
        }
        private void PostIntoAccount(long chlnidno, string GrType)
        {
            ChlnBookingDAL  objChln      = new ChlnBookingDAL();
            tblChlnBookHead chlnBookhead = objChln.selectHead(chlnidno, GrType);

            if (this.RecPostIntoAccounts(Convert.ToDouble(chlnBookhead.Adv_Amnt), Convert.ToInt32(chlnidno), "CBU", 0, 0, 0, 0, 0, Convert.ToInt32(chlnBookhead.Year_Idno), Convert.ToInt32(chlnBookhead.Truck_Idno), Convert.ToString(chlnBookhead.Inst_Dt), (string.IsNullOrEmpty(chlnBookhead.Inst_No.ToString()) ? "0" : Convert.ToString(chlnBookhead.Inst_No)), (string.IsNullOrEmpty(chlnBookhead.Driver_Idno.ToString()) ? 0 : Convert.ToInt32(chlnBookhead.Driver_Idno)), Convert.ToDateTime(chlnBookhead.Chln_Date).ToString("dd-MM-yyyy"), Convert.ToInt32(chlnBookhead.Chln_No), (string.IsNullOrEmpty(chlnBookhead.RcptType_Idno.ToString()) ? 0 : Convert.ToInt32(chlnBookhead.RcptType_Idno)), (string.IsNullOrEmpty(chlnBookhead.Bank_Idno.ToString()) ? 0 : Convert.ToInt32(chlnBookhead.Bank_Idno)), Convert.ToDouble(chlnBookhead.Gross_Amnt), Convert.ToDouble(chlnBookhead.Commsn_Amnt), Convert.ToDouble(chlnBookhead.TDSTax_Amnt), (string.IsNullOrEmpty(chlnBookhead.Diesel_Amnt.ToString()) ? 0.00 : Convert.ToDouble(chlnBookhead.Diesel_Amnt))) == true)
            {
                //   tScope.Complete(); tScope.Dispose();
                objChln.UpdateIsPosting(chlnidno);
            }
        }
        private void BindCity()
        {
            BindDropdownDAL obj     = new BindDropdownDAL();
            var             FrmCity = obj.BindLocFrom();

            drpBaseCity.DataSource     = FrmCity;
            drpBaseCity.DataTextField  = "City_Name";
            drpBaseCity.DataValueField = "City_Idno";
            drpBaseCity.DataBind();
            objChlnBookingDAL = null;
            drpBaseCity.Items.Insert(0, new System.Web.UI.WebControls.ListItem("--Select--", "0"));
        }
Esempio n. 10
0
        private void BindDestination()
        {
            BindDropdownDAL obj       = new BindDropdownDAL();
            var             DestiCity = obj.BindAllToCity();

            ddlDestination.DataSource     = DestiCity;
            ddlDestination.DataTextField  = "City_Name";
            ddlDestination.DataValueField = "City_Idno";
            ddlDestination.DataBind();
            objChlnBookingDAL = null;
            ddlDestination.Items.Insert(0, new System.Web.UI.WebControls.ListItem("--Select--", "0"));
        }
        public bool UpdateChallan(Int64 chlnidno, double commissionAmnt, double tdsAmnt)
        {
            ChlnBookingDAL objChallan = new ChlnBookingDAL();

            if (chlnidno > 0)
            {
                if (objChallan.BulkUpdateChallan(ApplicationFunction.ConnectionString(), chlnidno, commissionAmnt, tdsAmnt))
                {
                    return(true);
                }
            }
            return(false);
        }
Esempio n. 12
0
        protected void grdTruckPrevLoc_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            string strMsg = string.Empty;

            if (e.CommandName == "cmdedit")
            {
                ViewState["Edit"] = true;
                Int64 iTrackIdno = Convert.ToInt64((e.CommandArgument == null ? "0" : e.CommandArgument).ToString());
                hidTrackIdno.Value = iTrackIdno.ToString();
                ChlnBookingDAL obj  = new ChlnBookingDAL();
                var            data = obj.SelectLorryTrackingLocByTrackIdno(ApplicationFunction.ConnectionString(), iTrackIdno);
                if (data.Rows.Count > 0)
                {
                    ddlCity.SelectedValue  = data.Rows[0]["City_Idno"].ToString();
                    txtTruckCurrDate.Text  = data.Rows[0]["Track_Date"].ToString();
                    txtTruckCurrTime.Text  = data.Rows[0]["Track_Time"].ToString();
                    chkTrackingSMS.Checked = Convert.ToBoolean((data.Rows[0]["SMS_Sent"] == null ? "false" : data.Rows[0]["SMS_Sent"]).ToString());
                }
            }
            else if (e.CommandName == "cmddelete")
            {
                Int64 iTrackIdno = Convert.ToInt64((e.CommandArgument == null ? "0" : e.CommandArgument).ToString());
                hidTrackIdno.Value = iTrackIdno.ToString();
                ChlnBookingDAL obj  = new ChlnBookingDAL();
                Int32          data = obj.DeleteLorryTrackingLocByTrackIdno(ApplicationFunction.ConnectionString(), iTrackIdno);
                if (data < 0)
                {
                    //MESSAAGE
                    this.ShowMessage("Tracking detail deleted.");
                }
                else
                {
                    //MESSAAGE
                    this.ShowMessageErr("Error deleting tracking detail.");
                }
            }
            else if (e.CommandName == "cmdSendSMS")
            {
                Int64  iTrackIdno  = Convert.ToInt64((e.CommandArgument == null ? "0" : e.CommandArgument).ToString());
                string strMobileNo = GetMobileNumbers(iTrackIdno);
                if (SendSMS(strMobileNo, GetMsg(iTrackIdno)))
                {
                    this.ShowMessage("Message sent to party.");
                }
                else
                {
                    this.ShowMessageErr("Error sending message.");
                }
            }
            ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop1", "PopUpTrackTruck()", true);
        }
Esempio n. 13
0
        // string con = ConfigurationManager.ConnectionStrings["TransportMandiConnectionString"].ConnectionString;
        #endregion

        #region Page Load...
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.UrlReferrer == null)
            {
                base.AutoRedirect();
            }
            if (!Page.IsPostBack)
            {
                if (base.CheckUserRights(intFormId) == false)
                {
                    Response.Redirect("PermissionDenied.aspx");
                }
                if (base.Print == false)
                {
                    imgBtnExcel.Visible = false;
                }

                this.BindDateRange();
                ddldateRange.SelectedValue = Convert.ToString(base.UserDateRng);
                ddldateRange_SelectedIndexChanged(null, null);

                txtReceiptDatefrom.Attributes.Add("onkeypress", "return notAllowAnything(event);");
                txtReceiptDateto.Attributes.Add("onkeypress", "return notAllowAnything(event);");


                ChlnBookingDAL obj    = new ChlnBookingDAL();
                DateTime?      dtfrom = null;
                DateTime?      dtto   = null;

                if (string.IsNullOrEmpty(Convert.ToString(txtReceiptDatefrom.Text)) == false)
                {
                    dtfrom = Convert.ToDateTime(ApplicationFunction.mmddyyyy(txtReceiptDatefrom.Text));
                }
                if (string.IsNullOrEmpty(Convert.ToString(txtReceiptDatefrom.Text)) == false)
                {
                    dtto = Convert.ToDateTime(ApplicationFunction.mmddyyyy(txtReceiptDateto.Text));
                }


                Int64 UserIdno = 0;
                if (Convert.ToString(Session["Userclass"]) != "Admin")
                {
                    UserIdno = Convert.ToInt64(Session["UserIdno"]);
                }


                obj = null;
            }
        }
Esempio n. 14
0
        private void BindTruckNo()
        {
            ChlnBookingDAL obj = new ChlnBookingDAL();
            var            lst = obj.selectTruckNo();

            obj = null;
            if (lst.Count > 0)
            {
                ddltruckNo.DataSource     = lst;
                ddltruckNo.DataTextField  = "Lorry_No";
                ddltruckNo.DataValueField = "Lorry_Idno";
                ddltruckNo.DataBind();
                ddltruckNo.Items.Insert(0, new ListItem("--Select--", "0"));
            }
        }
Esempio n. 15
0
        private void PopulateChallanHead(long iChlnId)
        {
            ChlnBookingDAL obj  = new ChlnBookingDAL();
            var            data = obj.SelectChallanHeadById(ApplicationFunction.ConnectionString(), iChlnId);

            if (data.Rows.Count > 0)
            {
                lblChlnNo.Text    = data.Rows[0]["Chln_No"].ToString();
                lblChlnDate.Text  = data.Rows[0]["Chln_Date"].ToString();
                lblLorryno.Text   = data.Rows[0]["Lorry_No"].ToString();
                lblPartyName.Text = data.Rows[0]["Acnt_Name"].ToString();
                lblLocFrm.Text    = data.Rows[0]["From_City"].ToString();
                lblLocTo.Text     = data.Rows[0]["To_City"].ToString();
            }
        }
Esempio n. 16
0
        protected void grdMain_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            string strMsg = string.Empty;

            if (e.CommandName == "cmdedit")
            {
                Response.Redirect("ChlnBooking.aspx?q=" + e.CommandArgument, true);
            }
            else if (e.CommandName == "cmddelete")
            {
                Int64          UserIdno = Convert.ToInt64(Session["UserIdno"]);
                ChlnBookingDAL obj      = new ChlnBookingDAL();
                Int32          intValue = obj.Delete(Convert.ToInt32(e.CommandArgument), UserIdno, ApplicationFunction.ConnectionString(), ddlGrtype.SelectedValue);
                obj = null;
                if (intValue > 0)
                {
                    this.BindGrid();
                    strMsg = "Record deleted successfully.";
                    txtReceiptNo.Focus();
                }
                else
                {
                    if (intValue == -1)
                    {
                        strMsg = "Record can not be deleted. It is in use.";
                    }
                    else
                    {
                        strMsg = "Record not deleted.";
                    }
                }
                ScriptManager.RegisterStartupScript(this, this.GetType(), "alertstrMsg", "PassMessage('" + strMsg + "')", true);
            }
            if (e.CommandName == "cmdAddTruckLoc")
            {
                Int64 iChlnId = 0;
                hidChlnidno.Value = e.CommandArgument.ToString();
                if (hidChlnidno.Value != "")
                {
                    iChlnId = Convert.ToInt64(e.CommandArgument.ToString());
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop1", "PopUpTrackTruck()", true);
                    //Show challan details
                    PopulateChallanHead(iChlnId);
                    PopulateTruckLocation(iChlnId);
                }
                ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop1", "PopUpTrackTruck()", true);
            }
        }
Esempio n. 17
0
        private void PopulateTruckLocation(Int64 iChlnId)
        {
            ChlnBookingDAL obj  = new ChlnBookingDAL();
            var            data = obj.SelectLorryTrackingLoc(ApplicationFunction.ConnectionString(), iChlnId);

            if (data.Rows.Count > 0)
            {
                grdTruckPrevLoc.DataSource = data;
                grdTruckPrevLoc.DataBind();
            }
            else
            {
                grdTruckPrevLoc.DataSource = null;
                grdTruckPrevLoc.DataBind();
            }
        }
Esempio n. 18
0
 private void TotalRecords()
 {
     using (TransportMandiEntities db = new TransportMandiEntities(MultipleDBDAL.strDynamicConString()))
     {
         string UserClass = Convert.ToString(Session["Userclass"]);
         Int64  UserIdno  = 0;
         if (UserClass != "Admin")
         {
             UserIdno = Convert.ToInt64(Session["UserIdno"]);
         }
         Int64          ITruckType    = Convert.ToInt64(ddllorrytype.SelectedValue);
         Int64          iFromCityIDNO = (drpBaseCity.SelectedIndex <= 0 ? 0 : Convert.ToInt64(drpBaseCity.SelectedValue));
         Int64          ITruckId      = (ddlTruckNo.SelectedIndex <= 0 ? 0 : Convert.ToInt64(ddlTruckNo.SelectedValue));
         ChlnBookingDAL obj           = new ChlnBookingDAL();
         DataTable      list1         = obj.SelectRep("SelectRep", Convert.ToDateTime(ApplicationFunction.mmddyyyy(txtDateFrom.Text)), Convert.ToDateTime(ApplicationFunction.mmddyyyy(txtDateTo.Text)), iFromCityIDNO, ITruckId, ITruckType, UserIdno, string.IsNullOrEmpty(ddlPartyName.SelectedValue) ? 0 : Convert.ToInt64(ddlPartyName.SelectedValue), Convert.ToInt64(ddlDestination.SelectedValue), conString);
         lblTotalRecord.Text = "T. Record (s): " + Convert.ToString(list1.Rows.Count);
     }
 }
Esempio n. 19
0
 protected void ddlTranstype_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (ddlTranstype.SelectedValue == "0")
     {
         BindTruckNo();
         lblTruckNo.Text = "Truck No.";
     }
     else if (ddlTranstype.SelectedValue == "1")
     {
         ChlnBookingDAL obj      = new ChlnBookingDAL();
         var            MiscList = obj.BindTransportaion(Convert.ToInt64(ddlTranstype.SelectedValue));
         ddltruckNo.DataSource     = MiscList;
         ddltruckNo.DataTextField  = "Misc_Name";
         ddltruckNo.DataValueField = "Misc_Idno";
         ddltruckNo.DataBind();
         ddltruckNo.Items.Insert(0, new ListItem("--Select--", "0"));
         lblTruckNo.Text = "Flight.";
     }
     else if (ddlTranstype.SelectedValue == "2")
     {
         ChlnBookingDAL obj      = new ChlnBookingDAL();
         var            MiscList = obj.BindTransportaion(Convert.ToInt64(ddlTranstype.SelectedValue));
         ddltruckNo.DataSource     = MiscList;
         ddltruckNo.DataTextField  = "Misc_Name";
         ddltruckNo.DataValueField = "Misc_Idno";
         ddltruckNo.DataBind();
         ddltruckNo.Items.Insert(0, new ListItem("--Select--", "0"));
         lblTruckNo.Text = "Train.";
     }
     else
     {
         ChlnBookingDAL obj      = new ChlnBookingDAL();
         var            MiscList = obj.BindTransportaion(Convert.ToInt64(ddlTranstype.SelectedValue));
         ddltruckNo.DataSource     = MiscList;
         ddltruckNo.DataTextField  = "Misc_Name";
         ddltruckNo.DataValueField = "Misc_Idno";
         ddltruckNo.DataBind();
         ddltruckNo.Items.Insert(0, new ListItem("--Select--", "0"));
         lblTruckNo.Text = "Bus.";
     }
 }
Esempio n. 20
0
        public static string[] GetTruckNo(string prefixText)
        {
            string         constr            = ApplicationFunction.ConnectionString();
            List <string>  TruckNumber       = new List <string>();
            DataTable      dtNames           = new DataTable();
            ChlnBookingDAL objChlnBookingDAL = new ChlnBookingDAL();
            DataSet        dt = objChlnBookingDAL.SelectTruckList(prefixText, ApplicationFunction.ConnectionString());

            if (dt != null && dt.Tables.Count > 0 && dt.Tables[0].Rows.Count > 0)
            {
                for (int i = 0; i < dt.Tables[0].Rows.Count; i++)
                {
                    string item = AjaxControlToolkit.AutoCompleteExtender.CreateAutoCompleteItem(Convert.ToString(dt.Tables[0].Rows[i]["Lorry_No"]), Convert.ToString(dt.Tables[0].Rows[i]["Lorry_Idno"]));
                    TruckNumber.Add(item);
                }
                return(TruckNumber.ToArray());
            }
            else
            {
                return(null);
            }
        }
        protected void ddlRcptTyp_SelectedIndexChanged(object sender, EventArgs e)
        {
            txtInstNo.Text         = ""; ddlCustmerBank.SelectedIndex = 0; txtInstDate.Text = "";
            rfvinstDate.Enabled    = rfvinstno.Enabled = false;
            txtInstNo.Enabled      = false; //rfvCusBank.Enabled = false;
            txtInstDate.Enabled    = false;
            ddlCustmerBank.Enabled = false; //rfvCusBank.Enabled = false;
            ChlnBookingDAL obj = new ChlnBookingDAL();
            DataTable      dt  = obj.BindRcptTypeDel(Convert.ToInt32(ddlRcptTyp.SelectedValue), ApplicationFunction.ConnectionString());

            if (dt != null && dt.Rows.Count > 0)
            {
                Int64 intAcnttype = Convert.ToInt64(dt.Rows[0]["ACNT_TYPE"]);
                if (intAcnttype == 4)
                {
                    rfvinstno.Enabled      = true;
                    txtInstNo.Enabled      = true; rfvinstno.Enabled = rfvinstDate.Enabled = true;
                    txtInstDate.Enabled    = true;
                    ddlCustmerBank.Enabled = true; //rfvCusBank.Enabled = true;
                }
            }
            ddlRcptTyp.Focus();
        }
Esempio n. 22
0
        private void BindGrid()
        {
            ChlnBookingDAL obj           = new ChlnBookingDAL();
            DataTable      list          = null;
            Int64          iFromCityIDNO = (drpBaseCity.SelectedIndex <= 0 ? 0 : Convert.ToInt64(drpBaseCity.SelectedValue));
            Int64          ITruckId      = (ddlTruckNo.SelectedIndex <= 0 ? 0 : Convert.ToInt64(ddlTruckNo.SelectedValue));
            Int64          ITruckType    = Convert.ToInt64(ddllorrytype.SelectedValue);
            string         UserClass     = Convert.ToString(Session["Userclass"]);
            Int64          UserIdno      = 0;

            if (UserClass != "Admin")
            {
                Query += " AND BaseCity_Idno in (select FrmCity_Idno from tblfrmcitydetl where User_Idno= " + Convert.ToInt64(Session["UserIdno"]) + ")";
            }
            if (txtDateFrom.Text != "")
            {
                Query += " AND CONVERT(DATE,Chln_Date)>='" + Convert.ToDateTime(txtDateFrom.Text.Trim(), cul).ToString("yyyy-MM-dd") + "'";
                // Query += " AND CONVERT(DATETIME,Chln_Date,105) >='" + Convert.ToDateTime(ApplicationFunction.mmddyyyy(txtDateFrom.Text))+"'";
            }
            if (txtDateTo.Text != "")
            {
                Query += " AND CONVERT(DATE,Chln_Date)<='" + Convert.ToDateTime(txtDateTo.Text.Trim(), cul).ToString("yyyy-MM-dd") + "'";
                //Query += " AND CONVERT(DATETIME,Chln_Date,105) <='" + Convert.ToDateTime(ApplicationFunction.mmddyyyy(txtDateTo.Text)) + "'";
            }
            if (Convert.ToInt32(drpBaseCity.SelectedValue) > 0)
            {
                Query += " AND BaseCity_Idno=" + Convert.ToInt32(drpBaseCity.SelectedValue);
            }
            if (Convert.ToInt64(ddlTruckNo.SelectedValue) > 0)
            {
                Query += " AND Truck_Idno=" + Convert.ToInt64(ddlTruckNo.SelectedValue);
            }
            if (Convert.ToInt64(ddllorrytype.SelectedValue) != 2)
            {
                Query += " AND Lorry_Type=" + Convert.ToInt64(ddllorrytype.SelectedValue);
            }
            if (Convert.ToInt64(ddlDestination.SelectedValue) > 0)
            {
                Query += " AND GH.DelvryPlce_Idno=" + Convert.ToInt64(ddlDestination.SelectedValue);
            }

            if (ddlReportType.SelectedValue == "0")
            {
                list = obj.SelectRep("SelectRep", Convert.ToDateTime(ApplicationFunction.mmddyyyy(txtDateFrom.Text)), Convert.ToDateTime(ApplicationFunction.mmddyyyy(txtDateTo.Text)), iFromCityIDNO, ITruckId, ITruckType, UserIdno, Convert.ToInt64(ddlPartyName.SelectedValue), Convert.ToInt64(ddlDestination.SelectedValue), conString);
            }
            if (ddlReportType.SelectedValue == "1")
            {
                list = obj.SelectChlnGrWiseRep("SelectRepGRWise", Query, conString);
            }

            if ((list != null) && (list.Rows.Count > 0))
            {
                ViewState["CSVdt"] = list;
                ////  CALC Footer OF GRID
                Amount     = Amount + Convert.ToDouble(list.Compute("SUM(Adv_Amnt)", ""));
                TDSAmnt    = TDSAmnt + Convert.ToDouble(list.Compute("SUM(TDS_Amnt)", ""));
                GrossAmnt  = GrossAmnt + Convert.ToDouble(list.Compute("SUM(Gross_Amnt)", ""));
                NetAmnt    = NetAmnt + Convert.ToDouble(list.Compute("SUM(Net_Amnt)", ""));
                Weight     = Weight + Convert.ToDouble(list.Compute("SUM(Tot_Weight)", ""));
                ShrtQty    = ShrtQty + Convert.ToDouble((list.Compute("SUM(Shortage_Qty)", "")) is DBNull ? 0 : (list.Compute("SUM(Shortage_Qty)", "")));
                Comm       = Comm + Convert.ToDouble(list.Compute("SUM(Comm_Amnt)", ""));
                Dieselamnt = Dieselamnt + Convert.ToDouble(list.Compute("SUM(Diesel_Amnt)", ""));
                ShrtAmnt   = ShrtAmnt + Convert.ToDouble((list.Compute("SUM(Shortage_Amount)", "")) is DBNull ? 0 : (list.Compute("SUM(Shortage_Amount)", "")));

                grdMain.DataSource = list;
                grdMain.DataBind();



                if (ddlReportType.SelectedValue == "0")
                {
                    grdMain.Columns[3].Visible = false;
                    grdMain.Columns[4].Visible = false;
                    grdMain.Columns[5].Visible = false;

                    grdMain.Columns[12].Visible = false;
                    grdMain.Columns[11].Visible = false;
                    grdMain.Columns[15].Visible = false;
                }
                else
                {
                    grdMain.Columns[3].Visible  = true;
                    grdMain.Columns[4].Visible  = true;
                    grdMain.Columns[5].Visible  = true;
                    grdMain.Columns[12].Visible = true;
                    grdMain.Columns[11].Visible = true;
                    grdMain.Columns[15].Visible = true;
                }
                if (CheckBox1.Checked)
                {
                    grdMain.Columns[16].Visible = true;
                    var test3 = grdMain.Columns[11].ToString();
                }
                else
                {
                    grdMain.Columns[16].Visible = false;
                }

                int startRowOnPage = (grdMain.PageIndex * grdMain.PageSize) + 1;
                int lastRowOnPage  = startRowOnPage + grdMain.Rows.Count - 1;

                imgBtnExcel.Visible = true;
                lnkbtnPrint.Visible = true;
                lblTotalRecord.Text = "T. Record (s): " + list.Rows.Count;
            }
            else
            {
                grdMain.DataSource = null;
                grdMain.DataBind();
                lnkbtnPrint.Visible = false;
                imgBtnExcel.Visible = false;
                lblTotalRecord.Text = "T. Record (s): 0 ";
            }
        }
Esempio n. 23
0
        private void BindGrid()
        {
            ChlnBookingDAL obj       = new ChlnBookingDAL();
            DateTime?      dtfrom    = null;
            DateTime?      dtto      = null;
            String         challanNo = txtReceiptNo.Text;

            if (string.IsNullOrEmpty(Convert.ToString(txtReceiptDatefrom.Text)) == false)
            {
                dtfrom = Convert.ToDateTime(ApplicationFunction.mmddyyyy(txtReceiptDatefrom.Text));
            }
            if (string.IsNullOrEmpty(Convert.ToString(txtReceiptDatefrom.Text)) == false)
            {
                dtto = Convert.ToDateTime(ApplicationFunction.mmddyyyy(txtReceiptDateto.Text));
            }
            int cityfrom = Convert.ToInt32((drpCityFrom.SelectedIndex <= 0) ? "0" : drpCityFrom.SelectedValue);

            if (txttruck.Visible == true)
            {
                ddltruckNo.SelectedValue = hfTruckNoId.Value == "" ? "0" : hfTruckNoId.Value;
            }

            int   TruckId  = Convert.ToInt32((ddltruckNo.SelectedIndex <= 0) ? "0" : ddltruckNo.SelectedValue);
            Int64 UserIdno = 0;

            if (Convert.ToString(Session["Userclass"]) != "Admin")
            {
                UserIdno = Convert.ToInt64(Session["UserIdno"]);
            }
            //var lstGridData=(IList)null;
            DataTable lstGridData = null;
            DataTable dtRcptDetl  = new DataTable();

            if (ddlGrtype.SelectedValue == "GR")
            {
                lstGridData = obj.searchBySP(ApplicationFunction.ConnectionString(), "SelectChallan", Convert.ToInt32(ddldateRange.SelectedValue), challanNo, dtfrom, dtto, cityfrom, TruckId, UserIdno, ddlGrtype.SelectedValue);
            }
            else
            {
                dtRcptDetl = obj.SelectGRRChlnDetail(ApplicationFunction.ConnectionString(), Convert.ToInt32(ddldateRange.SelectedValue), challanNo, dtfrom, dtto, cityfrom, TruckId, UserIdno, ddlGrtype.SelectedValue, Convert.ToString(ddlTranstype.SelectedValue));
            }
            #region Gr....
            obj = null;
            if ((lstGridData != null && lstGridData.Rows.Count > 0))
            {
                DataTable dt = new DataTable();
                dt.Columns.Add("ChlnDate", typeof(string));
                dt.Columns.Add("ChlnNo", typeof(string));
                dt.Columns.Add("LorryNo", typeof(string));
                dt.Columns.Add("FromCity", typeof(string));
                dt.Columns.Add("NetAmnt", typeof(string));

                double TNet = 0;
                for (int i = 0; i < lstGridData.Rows.Count; i++)
                {
                    DataRow dr = dt.NewRow();
                    dr["ChlnDate"] = Convert.ToDateTime(lstGridData.Rows[i]["Chln_Date"]).ToString("dd-MM-yyyy");
                    dr["ChlnNo"]   = Convert.ToString(lstGridData.Rows[i]["Chln_No"]);
                    dr["LorryNo"]  = Convert.ToString(lstGridData.Rows[i]["Lorry_No"]);
                    dr["FromCity"] = Convert.ToString(lstGridData.Rows[i]["FromCity"]);
                    dr["NetAmnt"]  = Convert.ToDouble(lstGridData.Rows[i]["Net_Amnt"]).ToString("N2");
                    dt.Rows.Add(dr);
                    TNet += Convert.ToDouble(lstGridData.Rows[i]["Net_Amnt"]);
                    if (i == lstGridData.Rows.Count - 1)
                    {
                        DataRow drr = dt.NewRow();
                        drr["ChlnDate"] = "";
                        drr["ChlnNo"]   = "";
                        drr["LorryNo"]  = "";
                        drr["FromCity"] = "Total";
                        drr["NetAmnt"]  = (TNet).ToString("N2");
                        dt.Rows.Add(drr);
                    }
                }
                if (dt != null && dt.Rows.Count > 0)
                {
                    ViewState["Dt"] = dt;
                }


                grdMain.DataSource = lstGridData;
                grdMain.DataBind();
                lblTotalRecord.Text = "T. Record (s): " + lstGridData.Rows.Count;

                Double TotalNetAmount = 0;

                for (int i = 0; i < lstGridData.Rows.Count; i++)
                {
                    TotalNetAmount += Convert.ToDouble(lstGridData.Rows[i]["Net_Amnt"]);
                }
                lblNetTotalAmount.Text = TotalNetAmount.ToString("N2");

                int startRowOnPage = (grdMain.PageIndex * grdMain.PageSize) + 1;
                int lastRowOnPage  = startRowOnPage + grdMain.Rows.Count - 1;
                lblcontant.Text     = "Showing " + startRowOnPage.ToString() + " - " + lastRowOnPage.ToString() + " of " + lstGridData.Rows.Count.ToString();
                lblcontant.Visible  = true;
                divpaging.Visible   = true;
                imgBtnExcel.Visible = true;
            }
            else if ((dtRcptDetl != null && dtRcptDetl.Rows.Count > 0))
            {
                DataTable dt = new DataTable();
                dt.Columns.Add("ChlnDate", typeof(string));
                dt.Columns.Add("ChlnNo", typeof(string));
                dt.Columns.Add("LorryNo", typeof(string));
                dt.Columns.Add("FromCity", typeof(string));
                dt.Columns.Add("NetAmnt", typeof(string));

                double TNet = 0;
                for (int i = 0; i < dtRcptDetl.Rows.Count; i++)
                {
                    DataRow dr = dt.NewRow();
                    dr["ChlnDate"] = Convert.ToDateTime(dtRcptDetl.Rows[i]["Chln_Date"]).ToString("dd-MM-yyyy");
                    dr["ChlnNo"]   = Convert.ToString((dtRcptDetl.Rows[i]["Chln_No"]));
                    dr["LorryNo"]  = Convert.ToString((dtRcptDetl.Rows[i]["Lorry_No"]));
                    dr["FromCity"] = Convert.ToString((dtRcptDetl.Rows[i]["FromCity"]));
                    dr["NetAmnt"]  = Convert.ToDouble((dtRcptDetl.Rows[i]["Net_Amnt"])).ToString("N2");
                    dt.Rows.Add(dr);
                    TNet += Convert.ToDouble((dtRcptDetl.Rows[i]["Net_Amnt"]));
                    if (i == dtRcptDetl.Rows.Count - 1)
                    {
                        DataRow drr = dt.NewRow();
                        drr["ChlnDate"] = "";
                        drr["ChlnNo"]   = "";
                        drr["LorryNo"]  = "";
                        drr["FromCity"] = "Total";
                        drr["NetAmnt"]  = (TNet).ToString("N2");
                        dt.Rows.Add(drr);
                    }
                }
                if (dt != null && dt.Rows.Count > 0)
                {
                    ViewState["Dt"] = dt;
                }


                grdMain.DataSource = dtRcptDetl;
                grdMain.DataBind();
                lblTotalRecord.Text = "T. Record (s): " + dtRcptDetl.Rows.Count;

                Double TotalNetAmount = 0;

                for (int i = 0; i < dtRcptDetl.Rows.Count; i++)
                {
                    TotalNetAmount += Convert.ToDouble((dtRcptDetl.Rows[i]["Net_Amnt"]));
                }
                lblNetTotalAmount.Text = TotalNetAmount.ToString("N2");

                int startRowOnPage = (grdMain.PageIndex * grdMain.PageSize) + 1;
                int lastRowOnPage  = startRowOnPage + grdMain.Rows.Count - 1;
                lblcontant.Text     = "Showing " + startRowOnPage.ToString() + " - " + lastRowOnPage.ToString() + " of " + dtRcptDetl.Rows.Count.ToString();
                lblcontant.Visible  = true;
                divpaging.Visible   = true;
                imgBtnExcel.Visible = true;
            }
            else
            {
                grdMain.DataSource = null;
                grdMain.DataBind();
                lblTotalRecord.Text = "T. Record (s): 0 ";
                lblcontant.Visible  = false;
                divpaging.Visible   = false;
                imgBtnExcel.Visible = false;
            }
            #endregion
        }
Esempio n. 24
0
        // string con = ConfigurationManager.ConnectionStrings["TransportMandiConnectionString"].ConnectionString;
        #endregion

        #region Page Load...
        protected void Page_Load(object sender, EventArgs e)
        {
            txtReceiptNo.Attributes.Add("onkeypress", "return allowAlphabetAndNumer(event);");
            if (Request.UrlReferrer == null)
            {
                base.AutoRedirect();
            }
            if (!Page.IsPostBack)
            {
                if (base.CheckUserRights(intFormId) == false)
                {
                    Response.Redirect("PermissionDenied.aspx");
                }
                if (base.Print == false)
                {
                    imgBtnExcel.Visible = false;
                }
                //this.BindState();
                if (Convert.ToString(Session["Userclass"]) == "Admin")
                {
                    this.BindCity();
                }
                else
                {
                    this.BindCity(Convert.ToInt64(Session["UserIdno"]));
                }
                drpCityFrom.SelectedValue = Convert.ToString(base.UserFromCity);
                this.BindDateRange();
                ddldateRange.SelectedValue = Convert.ToString(base.UserDateRng);
                ddldateRange_SelectedIndexChanged(null, null);
                this.BindTruckNo();
                txtReceiptDatefrom.Attributes.Add("onkeypress", "return notAllowAnything(event);");
                txtReceiptDateto.Attributes.Add("onkeypress", "return notAllowAnything(event);");

                lblTruckNo.Text = "Truck No.";
                ChlnBookingDAL obj       = new ChlnBookingDAL();
                DateTime?      dtfrom    = null;
                DateTime?      dtto      = null;
                String         challanNo = txtReceiptNo.Text;
                if (string.IsNullOrEmpty(Convert.ToString(txtReceiptDatefrom.Text)) == false)
                {
                    dtfrom = Convert.ToDateTime(ApplicationFunction.mmddyyyy(txtReceiptDatefrom.Text));
                }
                if (string.IsNullOrEmpty(Convert.ToString(txtReceiptDatefrom.Text)) == false)
                {
                    dtto = Convert.ToDateTime(ApplicationFunction.mmddyyyy(txtReceiptDateto.Text));
                }
                int cityfrom = Convert.ToInt32((drpCityFrom.SelectedIndex <= 0) ? "0" : drpCityFrom.SelectedValue);

                int TruckId = Convert.ToInt32((ddltruckNo.SelectedIndex <= 0) ? "0" : ddltruckNo.SelectedValue);

                Int64 UserIdno = 0;
                if (Convert.ToString(Session["Userclass"]) != "Admin")
                {
                    UserIdno = Convert.ToInt64(Session["UserIdno"]);
                }
                DataTable lstGridData = null;
                lstGridData = obj.searchBySP(ApplicationFunction.ConnectionString(), "SelectChallan", Convert.ToInt32(ddldateRange.SelectedValue), challanNo, dtfrom, dtto, cityfrom, TruckId, UserIdno, ddlGrtype.SelectedValue);
                obj         = null;
                if (lstGridData != null && lstGridData.Rows.Count > 0)
                {
                    lblTotalRecord.Text = "T. Record (s): " + lstGridData.Rows.Count;
                }
                Trantype();
                BindCity();
            }
        }
Esempio n. 25
0
 protected void AddTrackingLocation(object sender, EventArgs e)
 {
     if (ddlCity.SelectedValue == "0")
     {
         ddlCity.Focus(); ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop1", "PopUpTrackTruck()", true); return;
     }
     if (txtTruckCurrDate.Text == String.Empty)
     {
         txtTruckCurrDate.Focus(); ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop1", "PopUpTrackTruck()", true); return;
     }
     if (txtTruckCurrTime.Text == String.Empty)
     {
         txtTruckCurrTime.Focus(); ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop1", "PopUpTrackTruck()", true); return;
     }
     if (hidChlnidno.Value != "")
     {
         Int64            iChlnIdno    = Convert.ToInt64(hidChlnidno.Value);
         Int64            returnStatus = 0;
         ChlnBookingDAL   obj          = new ChlnBookingDAL();
         tblLorryTrackLoc tblTrackLoc  = new tblLorryTrackLoc();
         tblTrackLoc.City_Idno     = Convert.ToInt64(ddlCity.SelectedValue);
         tblTrackLoc.Chln_Idno     = iChlnIdno;
         tblTrackLoc.Track_Date    = Convert.ToDateTime(txtTruckCurrDate.Text).Date;
         tblTrackLoc.Track_Time    = Convert.ToDateTime(txtTruckCurrTime.Text).TimeOfDay;
         tblTrackLoc.User_Idno     = 2;
         tblTrackLoc.Date_Added    = DateTime.Now;
         tblTrackLoc.Date_Modified = DateTime.Now;
         tblTrackLoc.SMS_Sent      = chkTrackingSMS.Checked;
         if (Convert.ToBoolean(ViewState["Edit"] == null ? "False" : ViewState["Edit"]))
         {
             returnStatus = obj.UpdateTrackingLocation(tblTrackLoc, Convert.ToInt64(hidTrackIdno.Value == "" ? "0" : hidTrackIdno.Value));
             if (chkTrackingSMS.Checked)
             {
                 string strMobileNo = GetMobileNumbers(returnStatus);
                 SendSMS(strMobileNo, GetMsg(returnStatus));
             }
         }
         else
         {
             returnStatus = obj.SaveTrackingLocation(tblTrackLoc);
             if (chkTrackingSMS.Checked)
             {
                 string strMobileNo = GetMobileNumbers(returnStatus);
                 SendSMS(strMobileNo, GetMsg(returnStatus));
             }
         }
         if (hidChlnidno.Value != "")
         {
             PopulateTruckLocation(Convert.ToInt64(hidChlnidno.Value == "" ? "0" : hidChlnidno.Value));
             ddlCity.SelectedValue  = "0";
             txtTruckCurrDate.Text  = "";
             txtTruckCurrTime.Text  = "";
             chkTrackingSMS.Checked = false;
         }
         if (returnStatus > 0)
         {
             this.ShowMessage("Tracking detail saved.");
         }
         else
         {
             this.ShowMessageErr("Error saving tracking detail.");
         }
     }
     ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop1", "PopUpTrackTruck()", true);
 }
        private bool RecPostIntoAccounts(double AdvAmount, Int64 intDocIdno, string strDocType, double dblRndOff, Int32 intCompIdno, Int32 intUserIdno, Int32 intUserType, Int32 intVchrForIdno, Int32 YearIdno, Int32 TruckIdno, string InstDate, string InstNo, Int32 DriverIdno, string strDate, Int32 intChlnNo, Int32 intRcptType, Int32 intCustBIdno, double dGrossAmnt, double dCommissionAmnt, double dTdsAmnt, double dDiesel)
        {
            #region Variables Declaration...
            Int64             intVchrIdno = 0; Int64 intValue = 0; Int32 IAcntIdno = 0; DateTime?dtBankDate = null;
            clsAccountPosting objclsAccountPosting = new clsAccountPosting();
            ChlnBookingDAL    objAcnt = new ChlnBookingDAL();
            BindDropdownDAL   objDal  = new BindDropdownDAL();
            #endregion
            #region Start Ac/Posting.........
            AcntLinkDS = objAcnt.DtAcntDS(ApplicationFunction.ConnectionString());
            DsHire     = objAcnt.DsHireAcnt(ApplicationFunction.ConnectionString());
            DataSet dsLD = objDal.GetLorryDetails(ApplicationFunction.ConnectionString(), "GetLorryDetails", TruckIdno, strDate);
            if (dsLD != null && dsLD.Tables.Count > 0 && dsLD.Tables[0].Rows.Count > 0)
            {
                Int32  intLtype   = string.IsNullOrEmpty(dsLD.Tables[0].Rows[0]["Lorry_Type"].ToString()) ? 0 : Convert.ToInt32(dsLD.Tables[0].Rows[0]["Lorry_Type"]);
                string strLorryNo = Convert.ToString(dsLD.Tables[0].Rows[0]["Lorry_No"]);
                Int32  PartyIdno  = Convert.ToInt32(dsLD.Tables[0].Rows[0]["Acnt_Idno"]);
                IAcntIdno = PartyIdno;
                #region Account link Validations...

                if (AcntLinkDS == null || AcntLinkDS.Rows.Count <= 0)
                {
                    ShowMessageErr("Account link is not defined. Kindly define.");
                    return(false);
                }

                ICAcnt_Idno = Convert.ToInt32(Convert.ToString(AcntLinkDS.Rows[0]["CAcnt_Idno"]) == "" ? 0 : Convert.ToInt32(AcntLinkDS.Rows[0]["CAcnt_Idno"]));
                if (ICAcnt_Idno <= 0)
                {
                    ShowMessageErr("Commission Account is not defined. Kindly define.");
                    return(false);
                }
                if (DsHire == null || DsHire.Rows.Count <= 0)
                {
                    ShowMessageErr("Transport Account is not defined. Kindly define.");
                    return(false);
                }
                else
                {
                    IHireAcntIdno = Convert.ToInt32(DsHire.Rows[0]["HireAccountID"]);
                }
                IntTDSAcntIdno = Convert.ToInt32(Convert.ToString(AcntLinkDS.Rows[0]["TDS_Idno"]) == "" ? 0 : Convert.ToInt32(AcntLinkDS.Rows[0]["TDS_Idno"]));
                if (IntTDSAcntIdno <= 0)
                {
                    ShowMessageErr("TDS Account is not defined. Kindly define.");
                    return(false);
                }
                //IntDieselAcc_Idno = Convert.ToInt32(ddlAcntLink.SelectedValue);
                //if (IntDieselAcc_Idno <= 0)
                //{
                //    hidpostingmsg.Value = "Diesel Account is not defined. Kindly define.";
                //    return false;
                //}

                #endregion
                #region Amount Posting............
                intValue = objclsAccountPosting.DeleteAccountPosting(intDocIdno, strDocType);
                #region Commission Account Posting ................
                if (dCommissionAmnt > 0)
                {
                    if (intValue > 0)
                    {
                        Int64 VchrNo = objclsAccountPosting.GetMaxVchrNo(4, 0, YearIdno);
                        intValue = objclsAccountPosting.InsertInVchrHead(
                            Convert.ToDateTime(ApplicationFunction.mmddyyyy(strDate)),
                            4,
                            0,
                            "Challan No: " + Convert.ToString(intChlnNo) + " Challan Date: " + strDate + " Lorry: " + strLorryNo + "Commission Posting",
                            true,
                            0,
                            strDocType,
                            0,
                            0,
                            Convert.ToInt64(intChlnNo),
                            ApplicationFunction.GetIndianDateTime().Date,
                            VchrNo,
                            0,
                            YearIdno,
                            0, intUserIdno);
                        if (intValue > 0)
                        {
                            intVchrIdno = intValue;
                            #region Commission Amount  Posting...
                            intValue = 0;
                            /*Insert In VchrDetl*/
                            intValue = objclsAccountPosting.InsertInVchrDetl(
                                intVchrIdno,
                                Convert.ToInt64(ICAcnt_Idno),
                                "Challan No: " + Convert.ToString(intChlnNo) + " Challan Date: " + strDate + " Lorry: " + strLorryNo + "Commission Posting",
                                dCommissionAmnt,
                                Convert.ToByte(1),
                                Convert.ToByte(0),
                                "",
                                true,
                                null, //please check here if date is Blank
                                "", 0);
                            if (intValue > 0)
                            {
                                intValue = 0;
                                intValue = objclsAccountPosting.InsertInVchrDetl(
                                    intVchrIdno,
                                    Convert.ToInt64(PartyIdno),
                                    "Challan No: " + Convert.ToString(intChlnNo) + " Challan Date: " + strDate + " Lorry: " + strLorryNo + "Commission Posting",
                                    Convert.ToDouble(dCommissionAmnt),
                                    Convert.ToByte(2),
                                    Convert.ToByte(0),
                                    "",
                                    false,
                                    null,     //please check here if date is Blank
                                    "", 0);

                                if (intValue == 0)
                                {
                                    return(false);
                                }

                                if (intValue > 0)
                                {
                                    intValue = 0; /*Insert In VchrIdDetl*/
                                    intValue = objclsAccountPosting.InsertInVchrIdDetl(intVchrIdno, intDocIdno, strDocType);
                                    if (intValue == 0)
                                    {
                                        return(false);
                                    }
                                }
                            }
                            else
                            {
                                return(false);
                            }

                            #endregion
                        }
                        else
                        {
                            return(false);
                        }
                    }
                    else
                    {
                        return(false);
                    }
                }
                #endregion
                #region  TDS Account Posting..................

                if (dTdsAmnt > 0 && IAcntIdno > 0)
                {
                    if (intValue > 0)
                    {
                        Int64 VchrNo = objclsAccountPosting.GetMaxVchrNo(4, 0, YearIdno);
                        intValue = objclsAccountPosting.InsertInVchrHead(
                            Convert.ToDateTime(ApplicationFunction.mmddyyyy(strDate)), 4, 0, "Challan No: " + Convert.ToString(intChlnNo) + " Challan Date: " + strDate + " Lorry: " + strLorryNo + "TDS Posting",
                            true, 0, strDocType, 0, 0, Convert.ToInt64(intChlnNo), ApplicationFunction.GetIndianDateTime().Date, VchrNo, 0,
                            YearIdno, 0, intUserIdno);
                        if (intValue > 0)
                        {
                            intVchrIdno = intValue;

                            #region TDS Account Posting .........

                            intValue = 0;
                            /*Insert In VchrDetl*/
                            intValue = objclsAccountPosting.InsertInVchrDetl(
                                intVchrIdno, Convert.ToInt64(IAcntIdno), "Challan No: " + Convert.ToString(intChlnNo) + " Challan Date: " + strDate + " Lorry: " + strLorryNo + "TDS Posting",
                                dTdsAmnt, Convert.ToByte(2), Convert.ToByte(0), "", true, null, //please check here if date is Blank
                                "", 0);
                            if (intValue > 0)
                            {
                                intValue = 0;
                                intValue = objclsAccountPosting.InsertInVchrDetl(
                                    intVchrIdno, IntTDSAcntIdno, "Challan. No: " + Convert.ToString(intChlnNo) + " Challan. Date: " + strDate + " Lorry: " + strLorryNo + "TDS Posting",
                                    Convert.ToDouble(dTdsAmnt), Convert.ToByte(1), Convert.ToByte(0), "", false,
                                    null,     //please check here if date is Blank
                                    "", 0);

                                if (intValue == 0)
                                {
                                    return(false);
                                }

                                if (intValue > 0)
                                {
                                    intValue = 0; /*Insert In VchrIdDetl*/
                                    intValue = objclsAccountPosting.InsertInVchrIdDetl(intVchrIdno, intDocIdno, strDocType);
                                    if (intValue == 0)
                                    {
                                        return(false);
                                    }
                                }
                            }
                            else
                            {
                                return(false);
                            }

                            #endregion
                        }
                        else
                        {
                            return(false);
                        }
                    }
                    else
                    {
                        return(false);
                    }
                }

                #endregion

                #endregion
                objclsAccountPosting = null;
                return(true);
            }
            else
            {
                objclsAccountPosting = null;
                return(true);
            }
            #endregion
        }
Esempio n. 27
0
        protected void grdMain_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            string strMsg = string.Empty;

            if (e.CommandName == "cmdedit")
            {
                Response.Redirect("ChlnBookingCrsng.aspx?q=" + e.CommandArgument, true);
            }
            if (e.CommandName == "cmddelete")
            {
                Int64          UserIdno = Convert.ToInt64(Session["UserIdno"]);
                ChlnBookingDAL obj      = new ChlnBookingDAL();
                Int32          intValue = obj.Delete(Convert.ToInt32(e.CommandArgument), UserIdno, ApplicationFunction.ConnectionString(), "GR");
                obj = null;
                if (intValue > 0)
                {
                    this.BindGrid();
                    strMsg = "Record deleted successfully.";
                    txtReceiptNo.Focus();
                }
                else
                {
                    if (intValue == -1)
                    {
                        strMsg = "Record can not be deleted. It is in use.";
                    }
                    else
                    {
                        strMsg = "Record not deleted.";
                    }
                }
                ScriptManager.RegisterStartupScript(this, this.GetType(), "alertstrMsg", "PassMessage('" + strMsg + "')", true);
            }
            //else if (e.CommandName == "cmdstatus")
            //{
            //    int intCityIdno = 0;
            //    bool bStatus = false;
            //    string[] strStatus = Convert.ToString(e.CommandArgument).Split(new char[] { '_' });
            //    if (strStatus.Length > 1)
            //    {
            //        intCityIdno = Convert.ToInt32(strStatus[0]);
            //        if (Convert.ToBoolean(strStatus[1]) == true)
            //            bStatus = false;
            //        else
            //            bStatus = true;
            //        CityMastDAL objclsCityMaster = new CityMastDAL();
            //        int value = objclsCityMaster.UpdateStatus(intCityIdno, bStatus);
            //        objclsCityMaster = null;
            //        if (value > 0)
            //        {
            //            this.BindGrid();
            //            strMsg = "Status updated successfully.";
            //            drpState.Focus();
            //        }
            //        else
            //        {
            //            strMsg = "Status not updated.";
            //        }
            //        ScriptManager.RegisterStartupScript(this, this.GetType(), "alertstrMsg", "PassMessage('" + strMsg + "')", true);
            //    }
            //}
            //drpState.Focus();
        }