Exemplo n.º 1
0
        public static List <IChargeRate> GetfwdInvoiceCharges(Int32 JobID, int EstimateID, int ChargeID, int DocTypeId, DateTime InvoiceDate)
        {
            string strExecution;

            strExecution = "[fwd].[usp_fwdInvoice_Charge]";

            List <IChargeRate> lstRates = new List <IChargeRate>();

            using (DbQuery oDq = new DbQuery(strExecution))
            {
                oDq.AddIntegerParam("@JobID", JobID);
                oDq.AddIntegerParam("@fk_EstimateID", EstimateID);
                oDq.AddIntegerParam("@chargeid", ChargeID);
                oDq.AddDateTimeParam("@InvoiceDate", InvoiceDate);

                DataTableReader reader = oDq.GetTableReader();

                while (reader.Read())
                {
                    IChargeRate chargeRate = new ChargeRateEntity(reader);
                    lstRates.Add(chargeRate);
                }

                reader.Close();
            }

            return(lstRates);
        }
        public static List <IChargeRate> GetInvoiceCharges_New(long BlId, int ChargesID, int TerminalID, decimal ExchangeRate, int DocTypeId, string Param3, DateTime InvoiceDate)
        {
            string             strExecution = "usp_Invoice_CalculateCharge";
            List <IChargeRate> lstRates     = new List <IChargeRate>();

            using (DbQuery oDq = new DbQuery(strExecution))
            {
                oDq.AddBigIntegerParam("@BLID", BlId);
                oDq.AddIntegerParam("@ChargeID", ChargesID);
                oDq.AddIntegerParam("@TerminalID", TerminalID);
                oDq.AddDecimalParam("@ExRate", 12, 2, ExchangeRate);
                oDq.AddIntegerParam("@DoctypeID", DocTypeId);
                oDq.AddVarcharParam("@Param3", 500, Param3);
                oDq.AddDateTimeParam("@InvoiceDate", InvoiceDate);

                DataTableReader reader = oDq.GetTableReader();

                while (reader.Read())
                {
                    IChargeRate chargeRate = new ChargeRateEntity(reader);
                    lstRates.Add(chargeRate);
                }

                reader.Close();
            }

            return(lstRates);
        }
Exemplo n.º 3
0
        void FillChargeRate(int ChargesID)
        {
            //oChargeRates = new List<ChargeRateEntity>();
            oChargeBLL = new ChargeBLL();
            Rates      = new List <IChargeRate>();
            Rates      = oChargeBLL.GetChargeRates(ChargesID);
            if (Rates.Count <= 0)
            {
                IChargeRate rt = new ChargeRateEntity();
                Rates.Add(rt);
            }
            else
            {
                ViewState["ChargeRates"] = Rates;
            }

            dgChargeRates.DataSource = Rates;
            dgChargeRates.DataBind();
        }
Exemplo n.º 4
0
        public static List <IChargeRate> GetChargeRates(int ChargesID)
        {
            string             strExecution = "[mst].[spGetChargeDetailsAndRate]";
            List <IChargeRate> ChrgRates    = new List <IChargeRate>();

            using (DbQuery oDq = new DbQuery(strExecution))
            {
                oDq.AddIntegerParam("@ChargeId", ChargesID);
                oDq.AddIntegerParam("@Mode", 2); // @Mode = 2 to fetch ChargeRate
                DataTableReader reader = oDq.GetTableReader();

                while (reader.Read())
                {
                    IChargeRate charg = new ChargeRateEntity(reader);
                    ChrgRates.Add(charg);
                }
                reader.Close();
            }
            return(ChrgRates);
        }
Exemplo n.º 5
0
        void FillRates()
        {
            Rates = (List <IChargeRate>)ViewState["ChargeRates"];
            IEnumerable <IChargeRate> Rts = from IChargeRate rt in Rates
                                            where rt.RateActive == true
                                            select rt;

            dgChargeRates.DataSource = Rts.ToList();
            dgChargeRates.DataBind();

            if (Rts.Count() <= 0)
            {
                List <IChargeRate> EmptyRates = new List <IChargeRate>();
                IChargeRate        rt         = new ChargeRateEntity();
                EmptyRates.Add(rt);

                dgChargeRates.DataSource = EmptyRates;
                dgChargeRates.DataBind();
                dgChargeRates.Rows[0].Visible = false;
            }
        }
        public static List <IChargeRate> GetInvoiceChargesById(long InvoiceId)
        {
            string             strExecution = "usp_Invoice_GetChargesById";
            List <IChargeRate> lstRates     = new List <IChargeRate>();

            using (DbQuery oDq = new DbQuery(strExecution))
            {
                oDq.AddBigIntegerParam("@InvoiceID", InvoiceId);

                DataTableReader reader = oDq.GetTableReader();

                while (reader.Read())
                {
                    IChargeRate footer = new ChargeRateEntity(reader);
                    lstRates.Add(footer);
                }

                reader.Close();
            }

            return(lstRates);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            //IUser user = (IUser)Session[Constants.SESSION_USER_INFO];
            //_userId = user == null ? 0 : user.Id;

            RetriveParameters();
            if (!Page.IsPostBack)
            {
                fillAllDropdown();
                //dgChargeRates.DataBind();

                if (hdnChargeID.Value != "0")
                {
                    FillChargeDetails(Convert.ToInt32(hdnChargeID.Value));
                    FillChargeRate(Convert.ToInt32(hdnChargeID.Value));
                    ActionOnLocationChange(ddlHeaderLocation as object);
                    //WashingSelection(rdbWashing);
                    ShowHideControlofFooter(ddlChargeType);

                    DisableAllField();
                }
                else
                {
                    DefaultSelection();
                    DateTime Cdate = DateTime.Now;
                    //FillDocType();
                    oChargeRates = new List <ChargeRateEntity>();
                    ChargeRateEntity Ent = new ChargeRateEntity();
                    oChargeRates.Add(Ent);
                    dgChargeRates.DataSource = oChargeRates;
                    dgChargeRates.DataBind();
                    dgChargeRates.Rows[0].Visible = false;
                    txtEffectDate.Text            = Cdate.AddDays(1).ToShortDateString();

                    //WashingSelection(rdbWashing);
                }
            }
            CheckUserAccess(hdnChargeID.Value);
        }
        public static List <IChargeRate> GetAllChargeRate(int ChargesID, long LocationID, int TerminalID) //, int WashingType
        {
            string strExecution = "usp_Invoice_GetCharges";

            List <IChargeRate> lstChargeRates = new List <IChargeRate>();

            using (DbQuery oDq = new DbQuery(strExecution))
            {
                oDq.AddIntegerParam("@ChargesID", ChargesID);
                oDq.AddBigIntegerParam("@LocationID", LocationID);
                oDq.AddIntegerParam("@TerminalID", TerminalID);
                //oDq.AddIntegerParam("@WashingType", WashingType);
                DataTableReader reader = oDq.GetTableReader();

                while (reader.Read())
                {
                    IChargeRate chargeRate = new ChargeRateEntity(reader);
                    lstChargeRates.Add(chargeRate);
                }
                reader.Close();
            }
            return(lstChargeRates);
        }
Exemplo n.º 9
0
        void ClearAll()
        {
            hdnChargeID.Value = "0";
            //ddlChargeType.SelectedIndex = 0;
            ddlCurrency.SelectedIndex = 0;
            //ddlLine.SelectedIndex = 0;
            ddlMLocation.SelectedIndex = 0;
            ddlMTerminal.SelectedIndex = 0;
            //ddlHeaderLocation.SelectedIndex = 0;

            txtChargeName.Text = string.Empty;
            txtEffectDate.Text = string.Empty;

            DefaultSelection();

            oChargeRates = new List <ChargeRateEntity>();
            ChargeRateEntity Ent = new ChargeRateEntity();

            oChargeRates.Add(Ent);
            dgChargeRates.DataSource = oChargeRates;
            dgChargeRates.DataBind();
            dgChargeRates.Rows[0].Visible = false;
        }
Exemplo n.º 10
0
        //public static List<IExpChargeRate> GetExpInvoiceCharges(long BlId, int ChargeID, int TerminalID, int DocTypeId, DateTime InvoiceDate)
        //{
        //    string strExecution;
        //    if (DocTypeId == 1)
        //        strExecution = "[exp].[usp_ExpInvFrt_Charge]";
        //    else
        //        strExecution = "[exp].[usp_ExpInvoice_Charge]";

        //    List<IExpChargeRate> lstRates = new List<IExpChargeRate>();

        //    using (DbQuery oDq = new DbQuery(strExecution))
        //    {
        //        oDq.AddBigIntegerParam("@BLID", BlId);
        //        oDq.AddIntegerParam("@ChargeID", ChargeID);
        //        oDq.AddIntegerParam("@TerminalID", TerminalID);
        //        oDq.AddIntegerParam("@DoctypeID", DocTypeId);
        //        oDq.AddDateTimeParam("@InvoiceDate", InvoiceDate);

        //        DataTableReader reader = oDq.GetTableReader();

        //        while (reader.Read())
        //        {
        //            IExpChargeRate chargeRate = new ExpChargeRateEntity(reader);
        //            lstRates.Add(chargeRate);
        //        }

        //        reader.Close();
        //    }

        //    return lstRates;
        //}



        public static List <IChargeRate> GetExpInvoiceCharges(long BlId, int ChargeID, int TerminalID, int DocTypeId, DateTime InvoiceDate)
        {
            string strExecution;

            if (DocTypeId == 19)
            {
                strExecution = "[exp].[usp_ExpInvFrt_Charge]";
            }
            else
            {
                strExecution = "[exp].[usp_ExpInvoice_Charge]";
            }

            List <IChargeRate> lstRates = new List <IChargeRate>();

            using (DbQuery oDq = new DbQuery(strExecution))
            {
                oDq.AddBigIntegerParam("@BLID", BlId);
                oDq.AddIntegerParam("@ChargeID", ChargeID);
                oDq.AddIntegerParam("@TerminalID", TerminalID);
                oDq.AddIntegerParam("@DoctypeID", DocTypeId);
                oDq.AddDateTimeParam("@InvoiceDate", InvoiceDate);

                DataTableReader reader = oDq.GetTableReader();

                while (reader.Read())
                {
                    IChargeRate chargeRate = new ChargeRateEntity(reader);
                    lstRates.Add(chargeRate);
                }

                reader.Close();
            }

            return(lstRates);
        }
Exemplo n.º 11
0
        protected void dgChargeRates_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (ViewState["ChargeRates"] == null)
            {
                ViewState["ChargeRates"] = Rates;
            }
            else
            {
                Rates = (List <IChargeRate>)ViewState["ChargeRates"];
            }


            #region Save
            if (e.CommandArgument == "Save")
            {
                //if (hdnChargeID.Value != "0")
                //{
                oChargeBLL = new ChargeBLL();
                GridViewRow Row = (GridViewRow)(((Button)e.CommandSource).NamingContainer);


                DropDownList ddlFTerminal = (DropDownList)Row.FindControl("ddlFTerminal");
                DropDownList ddlType      = (DropDownList)Row.FindControl("ddlType");
                DropDownList ddlSize      = (DropDownList)Row.FindControl("ddlSize");


                TextBox txtRateperUnit = (TextBox)Row.FindControl("txtRateperUnit");
                TextBox txtRatePerDoc  = (TextBox)Row.FindControl("txtRatePerDoc");
                TextBox txtRatePerCBM  = (TextBox)Row.FindControl("txtRatePerCBM");
                TextBox txtRatePerTON  = (TextBox)Row.FindControl("txtRatePerTON");


                HiddenField hdnFId   = (HiddenField)Row.FindControl("hdnFId");
                HiddenField hdnId    = (HiddenField)Row.FindControl("hdnId");
                HiddenField hdnFSlno = (HiddenField)Row.FindControl("hdnFSlno");


                oEntity           = new ChargeRateEntity();
                oEntity.ChargesID = Convert.ToInt32(hdnChargeID.Value);

                if (ddlFTerminal.Items.Count > 0 && ddlFTerminal.SelectedIndex >= 0)
                {
                    oEntity.TerminalId = Convert.ToInt32(ddlFTerminal.SelectedValue);
                }

                if (ddlType.Items.Count > 0 && ddlType.SelectedIndex >= 0)
                {
                    oEntity.Type = Convert.ToInt32(ddlType.SelectedValue);
                }

                if (ddlSize.Items.Count > 0 && ddlSize.SelectedIndex >= 0)
                {
                    oEntity.Size = ddlSize.SelectedValue;
                }

                oEntity.RateActive = true;

                oEntity.RatePerUnit = Convert.ToDecimal(string.IsNullOrEmpty(txtRateperUnit.Text) == false ? txtRateperUnit.Text : "0.00");
                oEntity.RatePerDoc  = Convert.ToDecimal(string.IsNullOrEmpty(txtRatePerDoc.Text) == false ? txtRatePerDoc.Text : "0.00");
                oEntity.RatePerCBM  = Convert.ToDecimal(string.IsNullOrEmpty(txtRatePerCBM.Text) == false ? txtRatePerCBM.Text : "0.00");
                oEntity.RatePerTON  = Convert.ToDecimal(string.IsNullOrEmpty(txtRatePerTON.Text) == false ? txtRatePerTON.Text : "0.00");



                if (Convert.ToInt32(hdnFSlno.Value) >= 0)
                {
                    oEntity.ChargesRateID = Convert.ToInt32(hdnFId.Value);
                    Rates.RemoveAt(Convert.ToInt32(hdnFSlno.Value));
                    Rates.Insert(Convert.ToInt32(hdnFSlno.Value), oEntity);
                    lblMessage.Text = string.Empty;

                    //IEnumerable<IChargeRate> cr = RangeValidationCheck(Convert.ToInt32(ddlHeaderLocation.SelectedValue), Convert.ToInt32(ddlFTerminal.SelectedValue), Convert.ToInt32(hdnFId.Value));
                    //if (cr.Count() <= 0)
                    //{
                    //    Rates.RemoveAt(Convert.ToInt32(hdnFSlno.Value));
                    //    Rates.Insert(Convert.ToInt32(hdnFSlno.Value), oEntity);
                    //    lblMessage.Text = string.Empty;
                    //}
                    //else
                    //{
                    //    lblMessage.Text = ResourceManager.GetStringWithoutName("ERR00079");
                    //    return;
                    //}
                }
                else
                {
                    Rates.Add(oEntity);
                }


                ViewState["ChargeRates"] = Rates;
                FillRates();
                DisableAllField();
                //ShowHideControlofFooter(ddlChargeType);
            }

            #endregion

            #region Edit
            if (e.CommandArgument == "Edit")
            {
                GridViewRow HeaderRow = dgChargeRates.HeaderRow;

                DropDownList ddlType = (DropDownList)HeaderRow.FindControl("ddlType");


                DropDownList ddlFTerminal   = (DropDownList)HeaderRow.FindControl("ddlFTerminal");
                DropDownList ddlSize        = (DropDownList)HeaderRow.FindControl("ddlSize");
                TextBox      txtRateperUnit = (TextBox)HeaderRow.FindControl("txtRateperUnit");
                TextBox      txtRatePerDoc  = (TextBox)HeaderRow.FindControl("txtRatePerDoc");
                TextBox      txtRatePerCBM  = (TextBox)HeaderRow.FindControl("txtRatePerCBM");
                TextBox      txtRatePerTON  = (TextBox)HeaderRow.FindControl("txtRatePerTON");
                HiddenField  hdnFId         = (HiddenField)HeaderRow.FindControl("hdnFId");
                HiddenField  hdnFSlno       = (HiddenField)HeaderRow.FindControl("hdnFSlno");


                GridViewRow ItemRow       = (GridViewRow)(((ImageButton)e.CommandSource).NamingContainer);
                HiddenField hdnTerminalId = (HiddenField)ItemRow.FindControl("hdnTerminalId");
                HiddenField hdnTypeId     = (HiddenField)ItemRow.FindControl("hdnTypeId");
                HiddenField hdnId         = (HiddenField)ItemRow.FindControl("hdnId");


                Label lblSize        = (Label)ItemRow.FindControl("lblSize");
                Label lblRatePerUnit = (Label)ItemRow.FindControl("lblRatePerUnit");
                Label lblRatePerDoc  = (Label)ItemRow.FindControl("lblRatePerDoc");
                Label lblRatePerCBM  = (Label)ItemRow.FindControl("lblRatePerCBM");
                Label lblRatePerTON  = (Label)ItemRow.FindControl("lblRatePerTON");

                //ddlType.SelectedIndex = ddlType.Items.IndexOf(ddlType.Items.FindByValue(hdnTypeId.Value));
                ddlType.SelectedValue = hdnTypeId.Value;

                ddlFTerminal.SelectedIndex = ddlFTerminal.Items.IndexOf(ddlFTerminal.Items.FindByValue(hdnTerminalId.Value));
                ddlSize.SelectedIndex      = ddlSize.Items.IndexOf(ddlSize.Items.FindByValue(lblSize.Text));

                txtRateperUnit.Text = lblRatePerUnit.Text;
                txtRatePerTON.Text  = lblRatePerTON.Text;
                txtRatePerDoc.Text  = lblRatePerDoc.Text;
                txtRatePerCBM.Text  = lblRatePerCBM.Text;

                hdnFId.Value   = hdnId.Value;
                hdnFSlno.Value = ItemRow.RowIndex.ToString();
                //UpdatePanel1.Update();
            }
            #endregion

            #region Delete
            if (e.CommandArgument == "Delete")
            {
                GridViewRow Row = (GridViewRow)(((ImageButton)e.CommandSource).NamingContainer);
                Rates = (List <IChargeRate>)ViewState["ChargeRates"];
                Rates.RemoveAt(Row.RowIndex);
                ViewState["ChargeRates"] = Rates;
                FillRates();
                //ShowHideControlofFooter(ddlChargeType);
            }
            #endregion

            #region Cancel
            if (e.CommandArgument == "Cancel")
            {
                GridViewRow Row = (GridViewRow)(((Button)e.CommandSource).NamingContainer);


                DropDownList ddlType      = (DropDownList)Row.FindControl("ddlType");
                DropDownList ddlFTerminal = (DropDownList)Row.FindControl("ddlFTerminal");
                DropDownList ddlSize      = (DropDownList)Row.FindControl("ddlSize");

                TextBox txtRateperUnit = (TextBox)Row.FindControl("txtRateperUnit");
                TextBox txtRatePerDoc  = (TextBox)Row.FindControl("txtRatePerDoc");
                TextBox txtRatePerCBM  = (TextBox)Row.FindControl("txtRatePerCBM");
                TextBox txtRatePerTON  = (TextBox)Row.FindControl("txtRatePerTON");

                HiddenField hdnFId   = (HiddenField)Row.FindControl("hdnFId");
                HiddenField hdnFSlno = (HiddenField)Row.FindControl("hdnFSlno");

                ddlType.SelectedIndex      = 0;
                ddlFTerminal.SelectedIndex = 0;
                //if (ddlFTerminal.Items.Count > 0)
                //{
                //    ddlFTerminal.Items.Clear();
                //}


                txtRateperUnit.Text = String.Empty; // "0.00";
                txtRatePerDoc.Text  = String.Empty; //"0.00";
                txtRatePerCBM.Text  = String.Empty; //"0.00";
                txtRatePerTON.Text  = String.Empty; //"0.00";

                hdnFId.Value   = "0";
                hdnFSlno.Value = "-1";
                //ShowHideControlofFooter(ddlChargeType);
            }
            #endregion


            //WashingSelection(rdbWashing);
            ////ShowHideControlofFooter(ddlChargeType);
            ////DisableAllField();
        }