Ejemplo n.º 1
0
 private void RePopulateGINForm(GINModel gm)
 {
     // txtDNSubmitedTime.Text = gm.TruckRequestTime.ToString();
     drpInventoryCoordinatorLoad.SelectedValue = Convert.ToString(gm.LeadInventoryControllerID);
     PopulateStack(new Guid(drpInventoryCoordinatorLoad.SelectedValue));
     btnPrint.Visible = true;
 }
Ejemplo n.º 2
0
        protected void btnAddStack_Click(object sender, EventArgs e)
        {
            StackTransactionModel sm = GetStack();

            //if (sm.IsValid())
            //{
            if (!RemainingWeight())
            {
                Messages.SetMessage("Requested Net Weight is greater than total available PUN weight. Please check the Loading Ticket.", WarehouseApplication.Messages.MessageType.Warning);
            }
            else
            {
                GINModel ginModel = new GINModel();
                ginModel = (GINModel)Session["GINMODEL"];
                try
                {
                    DateTime dtm  = DateTime.Parse((Convert.ToDateTime(txtDateWeighted.Text).ToShortDateString()) + " " + Convert.ToDateTime(txtDateWeightedTime.Text).ToShortTimeString());
                    DateTime dtm2 = DateTime.Parse((Convert.ToDateTime(txtDateLoaded.Text).ToShortDateString()) + " " + Convert.ToDateTime(txtDateLoadedTime.Text).ToShortTimeString());
                    ginModel.AddStack(new Guid(drpStackNo.SelectedValue), new Guid(drpWeigherSupervisor.SelectedValue), txtScaleTicketNo.Text, txtLoadingTicket.Text, dtm, Convert.ToDouble(txtTruckWeight.Text), Convert.ToDouble(txtGrossWeight.Text), Convert.ToDouble(txtNoOfBags.Text), dtm2, Convert.ToInt32(drpTruckType.SelectedValue), Convert.ToInt32(drpWBServiceProvider.SelectedValue));
                    btnAddStack.Visible = false;
                }
                catch (Exception ex)
                {
                    Messages.SetMessage(ex.Message, WarehouseApplication.Messages.MessageType.Warning);
                }
                gvStack.DataSource = ginModel.StackInfosList;
                gvStack.DataBind();
                Session["GINMODEL"] = ginModel;
                DoNewStack();
            }
            //}
        }
Ejemplo n.º 3
0
        private void BindData()
        {
            int    warehouseReceipt;
            string LICName;
            string clientId = txtClientId.Text;

            if (drpLIC.SelectedItem.Value != string.Empty)
            {
                LICName = drpLIC.SelectedItem.Value.ToString();
            }
            else
            {
                LICName = string.Empty;
            }
            string GinNo       = txtGINNo.Text;
            Guid   warehouseId = UserBLL.GetCurrentWarehouse();

            if (txtWareHouseReceipt.Text.Equals(string.Empty))
            {
                warehouseReceipt = 0;
            }
            else
            {
                warehouseReceipt = Convert.ToInt32(txtWareHouseReceipt.Text);
            }


            List <GINModel> gmList = new List <GINModel>();

            gmList = GINModel.getUnApprovedGin(clientId, warehouseReceipt, LICName, GinNo, warehouseId);
            gvApproval.DataSource = gmList;
            gvApproval.DataBind();
        }
Ejemplo n.º 4
0
        private void detail_Format(object sender, EventArgs e)
        {
            GINModel  objPUN = new GINModel();
            rptSubGIN rp     = new rptSubGIN();

            rp.DataSource       = GINBussiness.GINModel.GetRemainingGin(new Guid(textBox5.Text), Convert.ToBoolean(txtisEdit.Text));
            subReportGin.Report = rp;
        }
Ejemplo n.º 5
0
        private void SaveBondedYardGIN()
        {
            GINModel ginmodel = CurrentGINModel;

            ginmodel.SaveBondedYard();
            Messages.SetMessage("GIN with GIN Number " + ginmodel.GINNumber + " is successfully saved " + Session["RemainingMsg"], WarehouseApplication.Messages.MessageType.Success);
            btnSave.Visible = false;
        }
Ejemplo n.º 6
0
        private void detail_Format(object sender, EventArgs e)
        {
            GINModel objSGIN            = new GINModel();
            rptSubGINStackBalance rpGIN = new rptSubGINStackBalance();

            rpGIN.DataSource  = objSGIN.GetGINStackBalance(new Guid(label11.Text), new Guid(label10.Text), new Guid(label9.Text), new Guid(label8.Text));
            subReport2.Report = rpGIN;
        }
Ejemplo n.º 7
0
        private void detail_Format(object sender, EventArgs e)
        {
            GINModel       objPUN = new GINModel();
            rptSUBGINScale rp     = new rptSUBGINScale();

            rp.DataSource       = GINBussiness.GINModel.GetRemainingGinByScale(new Guid(textBox6.Text));
            subReportGin.Report = rp;
        }
Ejemplo n.º 8
0
        private void SaveGINPSA()
        {
            GINModel ginPSAModel = CurrentGINModel;

            ginPSAModel.IsPSA = true;
            ginPSAModel.SavePSA();

            Messages.SetMessage("PSA with PSA Number " + ginPSAModel.GINNumber + " is saved successfully ", WarehouseApplication.Messages.MessageType.Success);
        }
Ejemplo n.º 9
0
        private void BindData()
        {
            int    warehouseReceipt;
            string clientId = txtClientId.Text;

            Guid?licID = null;

            if (drpLIC.SelectedIndex > 0)
            {
                licID = new Guid(drpLIC.SelectedItem.Value);
            }
            string PSANo       = txtPSANo.Text;
            Guid   warehouseId = UserBLL.GetCurrentWarehouse();

            if (txtWareHouseReceipt.Text.Equals(string.Empty))
            {
                warehouseReceipt = 0;
            }
            else
            {
                warehouseReceipt = Convert.ToInt32(txtWareHouseReceipt.Text);
            }
            //if (clientId.Trim().Length <= 0 && licID == null && warehouseReceipt == 0 && PSANo.Trim().Length <= 0)
            //{
            //    Messages.SetMessage("Please select/enter on one of the search criteria", WarehouseApplication.Messages.MessageType.Warning);
            //    return;
            //}

            List <GINModel> gmList = new List <GINModel>();

            gmList = GINModel.getUnApprovedPSA(clientId, warehouseReceipt, licID, PSANo, warehouseId);
            gvApproval.DataSource = gmList;
            gvApproval.DataBind();
            if ((txtPSANo.Text.Trim().Length > 0 || txtWareHouseReceipt.Text.Trim().Length > 0) && gmList != null && gmList.Count > 0)
            {
                try
                {
                    drpLIC.SelectedValue = gmList[0].LeadInventoryControllerID.ToString();
                }
                catch
                {
                    drpLIC.SelectedIndex = 0;
                    for (int i = 1; drpLIC.Items.Count > i; i++)
                    {
                        if (drpLIC.Items[i].Text == gmList[0].LeadInventoryController)
                        {
                            drpLIC.SelectedIndex = i;
                            break;
                        }
                    }
                    if (drpLIC.SelectedIndex == 0)
                    {
                        Messages.SetMessage("LIC " + gmList[0].LeadInventoryController + " not found in the list", WarehouseApplication.Messages.MessageType.Warning);
                    }
                }
            }
        }
Ejemplo n.º 10
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            bool isCoffee            = false;
            StackTransactionModel sm = GetStack();
            GINModel gm = CurrentGINModel;

            if (CurrentGINModel.PickupNoticesList[0].Commodity == new Guid("71604275-df23-4449-9dae-36501b14cc3b"))
            {
                isCoffee = true;
            }
            string errorMessage = string.Empty;

            try
            {
                if (RemainingWeight())
                {
                    if (SateGIN())
                    {
                        if (sm.IsValid(isCoffee))
                        {
                            if (isCoffee)
                            {
                                SaveBondedYardGIN();
                            }
                            else
                            {
                                gm.AddStack(sm);
                                if (gm.IsValid())
                                {
                                    SaveGIN();
                                }
                                else
                                {
                                    errorMessage = gm.ErrorMessage;
                                    Messages.SetMessage(gm.ErrorMessage, WarehouseApplication.Messages.MessageType.Error);
                                }
                            }
                        }
                        else
                        {
                            errorMessage = gm.ErrorMessage;
                            Messages.SetMessage(gm.ErrorMessage, WarehouseApplication.Messages.MessageType.Error);
                        }
                    }
                    else
                    {
                        Session["remainingBalance"] = null;
                    }
                }
            }
            catch (Exception ex)
            {
                Session["remainingBalance"] = Convert.ToDouble(Session["remainingBalance"]) + Convert.ToDouble(Session["netWeight"]);
                Messages.SetMessage(ex.Message.ToString(), WarehouseApplication.Messages.MessageType.Error);
            }
        }
Ejemplo n.º 11
0
        protected void btnApprove_Click(object sender, EventArgs e)
        {
            Messages.ClearMessage();
            string ginApprovalInfoXML = "<PSAApproval>";
            string errorMsg = ""; DateTime dtValue = new DateTime();

            foreach (GridViewRow gvr in this.gvApproval.Rows)
            {
                if (((CheckBox)gvr.FindControl("chkSelect")).Checked == true)
                {
                    DropDownList cStatus = (DropDownList)gvApproval.Rows[gvr.RowIndex].FindControl("drpClientStatus");
                    if (cStatus.SelectedIndex <= 0)
                    {
                        errorMsg += "the client signed status must me selected! ";
                    }
                    DropDownList licStatus = (DropDownList)gvApproval.Rows[gvr.RowIndex].FindControl("drpLICStatus");
                    if (licStatus.SelectedIndex <= 0)
                    {
                        errorMsg += "the LIC signed status must me selected! ";
                    }
                    TextBox cdate = (TextBox)gvApproval.Rows[gvr.RowIndex].FindControl("txtDateTimeClientSigned");
                    TextBox ctime = (TextBox)gvApproval.Rows[gvr.RowIndex].FindControl("txtTimeClientSigned");
                    if (!DateTime.TryParse(cdate.Text + " " + ctime.Text, out dtValue) || dtValue > DateTime.Now)
                    {
                        errorMsg += "please select current Client signed date and time! ";
                    }
                    TextBox licdate = (TextBox)gvApproval.Rows[gvr.RowIndex].FindControl("txtDateTimeLICSigned");
                    TextBox lictime = (TextBox)gvApproval.Rows[gvr.RowIndex].FindControl("txtTimeLICSigned");
                    if (!DateTime.TryParse(licdate.Text + " " + lictime.Text, out dtValue) || dtValue > DateTime.Now)
                    {
                        errorMsg += "please select current LIC signed date and time! ";
                    }
                    if (errorMsg != string.Empty)
                    {
                        errorMsg = "For the PSA with number '" + ((Label)gvr.FindControl("lblPSA")).Text + "' " + errorMsg;
                        Messages.SetMessage(errorMsg, WarehouseApplication.Messages.MessageType.Error);
                        return;
                    }
                    ginApprovalInfoXML +=
                        "<PSAApprovalItem> <ID>" + gvApproval.DataKeys[gvr.RowIndex].Value.ToString() + "</ID>" +
                        "<ClientSignedDate>" + ((TextBox)gvApproval.Rows[gvr.RowIndex].FindControl("txtDateTimeClientSigned")).Text + " " + ((TextBox)gvApproval.Rows[gvr.RowIndex].FindControl("txtTimeClientSigned")).Text + "</ClientSignedDate>" +
                        "<ClientSignedName>" + BLL.UserBLL.CurrentUser.FullName + "</ClientSignedName>" +
                        "<LICSignedDate>" + ((TextBox)gvApproval.Rows[gvr.RowIndex].FindControl("txtDateTimeLICSigned")).Text + " " + ((TextBox)gvApproval.Rows[gvr.RowIndex].FindControl("txtTimeLICSigned")).Text + "</LICSignedDate>" +
                        "<LICSignedName>" + BLL.UserBLL.CurrentUser.FullName + "</LICSignedName>" +
                        "<PSAStatusID>" + CalculatePSAStatus(gvr) + "</PSAStatusID>" +
                        "<PSAStatusID>" + CalculatePSAStatus(gvr) + "</PSAStatusID>" +
                        "<UserId>" + BLL.UserBLL.CurrentUser.UserId + "</UserId>" +
                        "</PSAApprovalItem>";
                }
            }
            ginApprovalInfoXML += "</PSAApproval>";
            GINModel.ApprovePSA(ginApprovalInfoXML);
            Messages.SetMessage("SUCCESS: The PSA Approved and it is out of unapproved list!", Messages.MessageType.Success);
            btnApprove.Style["visibility"] = "hidden";
            BindData();
        }
Ejemplo n.º 12
0
 protected void btnOk_Click(object sender, EventArgs e)
 {
     foreach (GridViewRow gvr in this.gvApproval.Rows)
     {
         GINModel objApp = new GINModel();
         objApp.ID = new Guid(Session["GinId"].ToString());
         Messages.SetMessage("SUCCESS: The Gin Approved and it is out of unapproved list!", Messages.MessageType.Success);
     }
     BindData();
 }
Ejemplo n.º 13
0
        private void detail_Format(object sender, EventArgs e)
        {
            GINModel       objPUN = new GINModel();
            rptSUBGINScale rp     = new rptSUBGINScale();

            if (textBox6.Text != "textBox6")
            {
                rp.DataSource = GINBussiness.GINModel.GetRemainingGinByScale(new Guid(textBox6.Text)); //Session["ConsType"].ToString()
            }
            subReportGin.Report = rp;
        }
Ejemplo n.º 14
0
 protected void gvSearchGIN_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "Search")
     {
         String gn = (String)(e.CommandArgument);
         Session["EditMode"] = true;
         GINModel gm = GINModel.GetGIN(gn);
         gm.PrepareGINEdit(gm.PickupNoticeId, gm.ID);
         Session["GINMODEL"] = gm;
         Response.Redirect("GIN.aspx");
     }
 }
Ejemplo n.º 15
0
        private void SateGIN()
        {
            GINModel ginModel = CurrentGINModel;

            ginModel.WarehouseID = UserBLL.GetCurrentWarehouse();
            ginModel.LeadInventoryControllerID = new Guid(drpInventoryCoordinatorLoad.SelectedValue);
            ginModel.IsPSA      = true;
            ginModel.DateIssued = DateTime.Now; //DateTime.Parse(Convert.ToDateTime(txtDateIssued.Text).ToShortDateString() + " " + Convert.ToDateTime(txtDateIssuedTime.Text).ToShortTimeString());
            ginModel.LeadInventoryController = drpInventoryCoordinatorLoad.SelectedItem.Text;
            ginModel.CreatedBy   = BLL.UserBLL.CurrentUser.UserId;
            ginModel.NetWeight   = ginModel.PickupNoticesList.Sum(s => s.RemainingWeight);// -Convert.ToDouble(Session["remainingBalance"]);
            ginModel.GINStatusID = Convert.ToInt32(GINStatusTypeEnum.New);
            btnPrint.Visible     = true;
        }
Ejemplo n.º 16
0
        protected void btnApprove_Click(object sender, EventArgs e)
        {
            string   ginApprovalInfoXML = "<GINApproval>";
            DateTime LICSignedDate, ManagerSignedDate;
            string   GINNO;

            foreach (GridViewRow gvr in this.gvApproval.Rows)
            {
                if (((CheckBox)gvr.FindControl("chkSelect")).Checked == true)
                {
                    if (((Label)gvr.FindControl("lblstatusLIC")).Text == "Reject")
                    {
                        Session["btnApprove"] = false;
                    }

                    LICSignedDate     = Convert.ToDateTime(((Label)gvApproval.Rows[gvr.RowIndex].Cells[0].FindControl("lblDateTimeLICSigned")).Text);
                    ManagerSignedDate = Convert.ToDateTime(((TextBox)gvApproval.Rows[gvr.RowIndex].Cells[0].FindControl("txtDateTimeManagerSigned")).Text + " " + ((TextBox)gvApproval.Rows[gvr.RowIndex].Cells[0].FindControl("txtTimeManagerSigned")).Text);
                    GINNO             = ((Label)gvApproval.Rows[gvr.RowIndex].Cells[0].FindControl("lblGINNo")).Text;
                    if (ManagerSignedDate > DateTime.Now)
                    {
                        Messages.SetMessage(" Manager Signed Date MUST NOT BE greater than todday!! on GIN Number" + GINNO, Messages.MessageType.Error);
                        return;
                    }
                    if (ManagerSignedDate >= LICSignedDate)
                    {
                        ginApprovalInfoXML +=
                            "<GINApprovalItem> <ID>" + gvApproval.DataKeys[gvr.RowIndex].Values["Id"].ToString() + "</ID>" +
                            "<ManagerSignedDate>" + ManagerSignedDate + "</ManagerSignedDate>" +
                            "<ManagerSignedName>" + BLL.UserBLL.CurrentUser.FullName + "</ManagerSignedName>" +
                            "<GINStatusID>" + CalculateGINStatus(gvr) + "</GINStatusID>" +
                            "</GINApprovalItem>";
                    }
                    else
                    {
                        Messages.SetMessage("  Manager Signed Date have to greater or equal to  LIC Signed Date.", Messages.MessageType.Warning);
                        return;
                    }
                }
            }
            if (!Convert.ToBoolean(Session["btnApprove"]))
            {
                Messages.SetMessage("You Can NOT Approve Rejected GIN!", Messages.MessageType.Error);
                Session["btnApprove"] = true;
                return;
            }
            ginApprovalInfoXML += "</GINApproval>";
            GINModel.ApproveManager(ginApprovalInfoXML);
            BindData();
            Messages.SetMessage("The Gin Approved and it is out of unapproved list!", Messages.MessageType.Success);
        }
Ejemplo n.º 17
0
        private bool RemainingWeight()
        {
            GINModel ginModel = (GINModel)Session["GINMODEL"];
            double   remainingBalance;

            if (Session["remainingBalance"] == null)
            {
                if (Session["EditMode"] == null)
                {
                    Session["remainingBalance"] = ginModel.PickupNoticesList.Sum(s => s.RemainingWeight);
                }
                else
                {
                    Session["remainingBalance"] = ginModel.PickupNoticesList.Sum(s => s.RemainingWeight);
                }
            }
            Guid commodityGradeId         = ((GINModel)Session["GINMODEL"]).PickupNoticesList[0].CommodityGradeID;
            List <BagTypeBLL> bagTypeList = BagTypeBLL.GetCommodityGradeBagTypes(commodityGradeId);

            double netWeight = 0;

            if (CurrentGINModel.PickupNoticesList[0].ConsignmentType != "Bonded Yard")
            {
                netWeight = double.Parse(txtGrossWeight.Text) - double.Parse(txtTruckWeight.Text) -
                            double.Parse(txtNoOfBags.Text) * double.Parse(HiddenFieldTare.Value) +
                            double.Parse(drpAdjustmentType.SelectedValue) * double.Parse(txtWeightAdjustment.Text);
            }
            else if (CurrentGINModel.PickupNoticesList[0].ConsignmentType == "Bonded Yard")
            {
                HiddenFieldTare.Value = "0.93";
                netWeight             = double.Parse(txtNetWeight.Text);
            }
            Session["netWeight"] = netWeight;
            remainingBalance     = Math.Round(double.Parse(Session["remainingBalance"].ToString()), 2) - Math.Round(netWeight, 2);
            if (CurrentGINModel.PickupNoticesList[0].Commodity != new Guid("71604275-df23-4449-9dae-36501b14cc3b"))
            {
                if (remainingBalance < 0)
                {
                    Messages.SetMessage("Requested Net Weight is greater than total available PUN weight. Please check the Loading Ticket.", WarehouseApplication.Messages.MessageType.Warning);
                    return(false);
                }
            }
            if (remainingBalance >= 0)
            {
                Session["RemainingMsg"] = "Selected PUNs have Total Remaining weights to be issued of = " + Convert.ToDouble(remainingBalance) + " Kg";
            }
            Session["remainingBalance"] = remainingBalance;

            return(true);
        }
Ejemplo n.º 18
0
        protected void OkButton_Click(object sender, EventArgs e)
        {
            GINModel ginModel        = (GINModel)Session["GINMODEL"];
            StackTransactionModel sm = new StackTransactionModel(CurrentGINModel);

            CurrentGINModel.stackList      = null;
            CurrentGINModel.StackInfosList = new List <StackTransactionModel>();
            Session.Remove("remainingBalance");

            gvStack.DataSource = null;
            gvStack.DataBind();
            PopulateStack(new Guid(drpInventoryCoordinatorLoad.SelectedValue));
            drpStackNo.Items.Insert(0, new ListItem("Select", string.Empty));
        }
Ejemplo n.º 19
0
        protected void gvStack_SelectedIndexChanged(object sender, EventArgs e)
        {
            GINModel gm            = (GINModel)Session["GINMODEL"];
            Guid     stackLoadedId = new Guid(gvStack.SelectedDataKey["StackID"].ToString());

            if (gm.StackInfosList.Count != 0)
            {
                StackTransactionModel stm     = gm.StackInfosList.First(s => s.StackID == stackLoadedId);
                Guid commodityGradeId         = ((GINModel)Session["GINMODEL"]).PickupNoticesList[0].CommodityGradeID;
                List <BagTypeBLL> bagTypeList = BagTypeBLL.GetCommodityGradeBagTypes(commodityGradeId);

                if (Session["remainingBalance"] == null)
                {
                    Session["remainingBalance"] = gm.PickupNoticesList.Sum(s => s.RemainingWeight);//+ (stm.GrossWeight - stm.TruckWeight - bagTypeList[0].Tare * stm.NoOfBags);
                }
                else
                {
                    Session["remainingBalance"] = (double)Session["remainingBalance"] + (stm.GrossWeight - stm.TruckWeight - stm.Tare * stm.NoOfBags);
                }
                txtScaleTicketNo.Text    = stm.ScaleTicketNumber;
                txtDateWeighted.Text     = stm.DateTimeWeighed.ToShortDateString();
                txtDateWeightedTime.Text = stm.DateTimeWeighed.ToShortTimeString();
                txtTruckWeight.Text      = stm.TruckWeight.ToString();
                txtGrossWeight.Text      = stm.GrossWeight.ToString();
                txtNoOfBags.Text         = stm.NoOfBags.ToString();
                txtLoadingTicket.Text    = stm.LoadUnloadTicketNO;
                PopulateStack(new Guid(drpInventoryCoordinatorLoad.SelectedValue));
                drpStackNo.SelectedValue = stm.StackID.ToString();
                //stm.StackID = new Guid(drpStackNo.SelectedValue);
                HiddenFieldTare.Value = stm.Tare.ToString();
                drpWeigherSupervisor.SelectedValue = stm.WeigherID.ToString();// drpWeigherSupervisor.Items.Cast<ListItem>().First(s => new Guid(s.Value) == stm.WeigherID).Value;
                gm.StackInfosList.Remove(stm);
                gm.RemoveStack(stm.StackID);
                btnAddStack.Visible = true;
                FillWBServiceProvider(drpWBServiceProvider);
                drpWBServiceProvider.SelectedValue = stm.WBServiceProviderID.ToString();
                //drp
                FillCarType(drpTruckType);
                drpTruckType.SelectedValue = stm.TruckTypeID.ToString();
                // gvStack.DataSource = gm.StackInfosList;
                // gvStack.DataBind();
            }
            else
            {
                Messages.SetMessage("The stack is already selected or Empty Stack.", WarehouseApplication.Messages.MessageType.Warning);
            }
        }
Ejemplo n.º 20
0
        protected void btnApprove_Click(object sender, EventArgs e)
        {
            string   ginApprovalInfoXML = "<GINApproval>";
            DateTime ClientSignedDate, LICSignedDate, DateIssued;
            string   GINNO;

            foreach (GridViewRow gvr in this.gvApproval.Rows)
            {
                if (((CheckBox)gvr.FindControl("chkSelect")).Checked == true)
                {
                    ClientSignedDate = Convert.ToDateTime(((TextBox)gvApproval.Rows[gvr.RowIndex].Cells[0].FindControl("txtDateTimeClientSigned")).Text + " " + ((TextBox)gvApproval.Rows[gvr.RowIndex].Cells[0].FindControl("txtTimeClientSigned")).Text);
                    LICSignedDate    = Convert.ToDateTime(((TextBox)gvApproval.Rows[gvr.RowIndex].Cells[0].FindControl("txtDateTimeLICSigned")).Text + " " + ((TextBox)gvApproval.Rows[gvr.RowIndex].Cells[0].FindControl("txtTimeLICSigned")).Text);

                    DateIssued = Convert.ToDateTime((gvApproval.Rows[gvr.RowIndex].Cells[7].Text));
                    GINNO      = ((Label)gvApproval.Rows[gvr.RowIndex].Cells[0].FindControl("lblGINNo")).Text;

                    if ((ClientSignedDate > DateTime.Now) || (LICSignedDate > DateTime.Now))
                    {
                        Messages.SetMessage(" Client Signed Date and LIC Signed Date MUST NOT BE greater than todday!! on GIN Number" + GINNO, Messages.MessageType.Error);
                        return;
                    }
                    if (ClientSignedDate >= DateIssued && LICSignedDate >= ClientSignedDate)
                    {
                        ginApprovalInfoXML +=
                            "<GINApprovalItem> <ID>" + gvApproval.DataKeys[gvr.RowIndex].Value.ToString() + "</ID>" +
                            "<ClientSignedDate>" + ClientSignedDate + "</ClientSignedDate>" +
                            "<ClientSignedName>" + BLL.UserBLL.CurrentUser.FullName + "</ClientSignedName>" +
                            "<LICSignedDate>" + LICSignedDate + "</LICSignedDate>" +
                            "<LICSignedName>" + BLL.UserBLL.CurrentUser.FullName + "</LICSignedName>" +
                            "<GINStatusID>" + CalculateGINStatus(gvr) + "</GINStatusID>" +
                            "</GINApprovalItem>";
                    }
                    else
                    {
                        Messages.SetMessage(" Client Signed Date and LIC Signed Date have to greater or equal to Date Issued. on GIN Number" + GINNO, Messages.MessageType.Warning);
                        return;
                    }
                }
            }
            ginApprovalInfoXML += "</GINApproval>";
            GINModel.Approve(ginApprovalInfoXML);
            BindData();

            Messages.SetMessage("The Gin Approved and it is out of unapproved list!", Messages.MessageType.Success);
        }
Ejemplo n.º 21
0
        protected void btnCancel_Click(object sender, EventArgs e)
        {
            string ginIds = string.Empty;

            foreach (GridViewRow gvr in this.gvApproval.Rows)
            {
                if (((CheckBox)gvr.FindControl("chkSelect")).Checked == true)
                {
                    if (!string.IsNullOrEmpty(ginIds))
                    {
                        ginIds += ",";
                    }
                    ginIds += gvApproval.DataKeys[gvr.RowIndex].Value.ToString();
                }
            }
            GINModel.CancelGIN(ginIds);
            BindData();
        }
Ejemplo n.º 22
0
        private void groupFooter1_Format(object sender, EventArgs e)
        {
            GINModel  objSGIN = new GINModel();
            DataTable dt      = objSGIN.GetTotalGINStackById(new Guid(label8.Text));

            if (dt.Rows.Count > 0)
            {
                txtTotalGinWeight.Text = dt.Rows[0]["NetWeight"].ToString();
                txtTotalGINBag.Text    = dt.Rows[0]["NoOfBug"].ToString();
                GinTotal      = Convert.ToDouble(txtTotalGinWeight.Text);
                GINBalanceBag = Convert.ToDouble(txtTotalGINBag.Text);
            }
            double total    = Math.Round((GrnTotal - GinTotal), 2);
            double totalBag = Math.Round((GRNBalanceBag - GINBalanceBag), 2);

            txtBalanceBag.Text       = totalBag.ToString();
            txtGrandTotalWeight.Text = total.ToString();
        }
Ejemplo n.º 23
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            StackTransactionModel sm = GetStack();
            GINModel gm           = CurrentGINModel;
            string   errorMessage = string.Empty;

            try
            {
                if (RemainingWeight())
                {
                    if (SateGIN())
                    {
                        if (sm.IsValid())
                        {
                            gm.AddStack(sm);
                            if (gm.IsValid())
                            {
                                SaveGIN();
                            }
                            else
                            {
                                errorMessage = gm.ErrorMessage;
                                Messages.SetMessage(gm.ErrorMessage, WarehouseApplication.Messages.MessageType.Error);
                            }
                        }
                        else
                        {
                            errorMessage = gm.ErrorMessage;
                            Messages.SetMessage(gm.ErrorMessage, WarehouseApplication.Messages.MessageType.Error);
                        }
                    }
                    else
                    {
                        Session["remainingBalance"] = null;
                    }
                }
            }
            catch (Exception ex)
            {
                Session["remainingBalance"] = Convert.ToDouble(Session["remainingBalance"]) + Convert.ToDouble(Session["netWeight"]);
                Messages.SetMessage(ex.Message.ToString(), WarehouseApplication.Messages.MessageType.Error);
            }
        }
Ejemplo n.º 24
0
        private void RePopulateGINForm(GINModel gm)
        {
            txtDateLoaded.Text              = gm.DateTimeLoaded.ToShortDateString();
            txtDateLoadedTime.Text          = gm.DateTimeLoaded.ToShortTimeString();
            drpAdjustmentType.SelectedValue = gm.AdjustmentTypeID.ToString();
            txtDriver.Text             = gm.DriverName;
            txtLicenseNo.Text          = gm.LicenseNumber;
            txtIssuedBy.Text           = gm.LicenseIssuedBy;
            txtTruckPlateNo.Text       = gm.PlateNumber;
            txtTrailerPlateNo.Text     = gm.TrailerPlateNumber;
            txtDNSubmitedTime.Text     = gm.TruckRequestTime.ToShortDateString();
            txtDNSubmitedTimeOnly.Text = gm.TruckRequestTime.ToShortTimeString();
            txtAvailableTime.Text      = gm.TruckRegisterTime.ToShortDateString();
            txtAvailableTimeOnly.Text  = gm.TruckRegisterTime.ToShortTimeString();
            txtDateIssued.Text         = gm.DateIssued.ToShortDateString();
            txtDateIssuedTime.Text     = gm.DateIssued.ToShortTimeString();
            txtWeightAdjustment.Text   = gm.WeightAdjustment.ToString();
            txtBagAdjustment.Text      = gm.BagAdjustment.ToString();
            drpDailyLabourersAssociation.SelectedValue = gm.DailyLabourersAssociationID.ToString();
            drpInventoryCoordinatorLoad.SelectedValue  = gm.LeadInventoryControllerID.ToString();

            if (drpInventoryCoordinatorLoad.SelectedValue != "")
            {
                PopulateStack(new Guid(drpInventoryCoordinatorLoad.SelectedValue));
            }

            drpWeigherSupervisor.Items.Insert(0, new ListItem("Select", string.Empty));
            drpInventoryCoordinatorLoad.Items.Insert(0, new ListItem("Select", string.Empty));
            drpWBServiceProvider.Items.Insert(0, new ListItem("Select", string.Empty));
            drpTruckType.Items.Insert(0, new ListItem("Select", string.Empty));

            drpDailyLabourersAssociation.Items.Insert(0, new ListItem("Select", string.Empty));
            txtRebag.Text = gm.NoOfRebags.ToString();
            Session["remainingBalance"] = CurrentGINModel.PickupNoticesList.Sum(p => p.RemainingWeight) - CurrentGINModel.StackInfosList.Sum(s => s.NetWeight);
            if (CurrentGINModel.StackInfosList.Count > 0)
            {
                btnAddStack.Visible = false;
            }
            //gvPUNInformation.DataSource = CurrentGINModel.PickupNoticesList;
            //gvPUNInformation.DataBind();
            btnPrint.Visible = true;
        }
Ejemplo n.º 25
0
        private bool SateGIN()
        {
            GINModel ginModel = CurrentGINModel;

            ginModel.DateTimeLoaded   = DateTime.Parse(Convert.ToDateTime(txtDateLoaded.Text).ToShortDateString() + " " + Convert.ToDateTime(txtDateLoadedTime.Text).ToShortTimeString());
            ginModel.AdjustmentTypeID = Convert.ToInt32(drpAdjustmentType.SelectedValue);
            try
            {
                string   driverFullName = txtDriver.Text.ToString().Trim();
                string[] tokenNames     = driverFullName.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);
                if (int.Parse(tokenNames.Length.ToString()) > 3 || int.Parse(tokenNames.Length.ToString()) < 3)
                {
                    throw new Exception("Invalid Driver Name!");
                }
            }
            catch (Exception ex)
            {
                Messages.SetMessage(ex.Message, WarehouseApplication.Messages.MessageType.Error);
                return(false);
            }
            ginModel.DriverName                = txtDriver.Text;
            ginModel.LicenseNumber             = txtLicenseNo.Text;
            ginModel.LicenseIssuedBy           = txtIssuedBy.Text;
            ginModel.PlateNumber               = txtTruckPlateNo.Text;
            ginModel.TrailerPlateNumber        = txtTrailerPlateNo.Text;
            ginModel.TruckRequestTime          = DateTime.Parse(Convert.ToDateTime(txtDNSubmitedTime.Text).ToShortDateString() + " " + Convert.ToDateTime(txtDNSubmitedTimeOnly.Text).ToShortTimeString());
            ginModel.TruckRegisterTime         = DateTime.Parse(Convert.ToDateTime(txtAvailableTime.Text).ToShortDateString() + " " + Convert.ToDateTime(txtAvailableTimeOnly.Text).ToShortTimeString());
            ginModel.DateIssued                = DateTime.Parse(Convert.ToDateTime(txtDateIssued.Text).ToShortDateString() + " " + Convert.ToDateTime(txtDateIssuedTime.Text).ToShortTimeString());
            ginModel.WeightAdjustment          = Convert.ToDouble(txtWeightAdjustment.Text);
            ginModel.BagAdjustment             = Convert.ToDouble(txtBagAdjustment.Text);
            ginModel.WarehouseID               = UserBLL.GetCurrentWarehouse();
            ginModel.LeadInventoryControllerID = new Guid(drpInventoryCoordinatorLoad.SelectedValue);
            ginModel.IsPSA = false;
            ginModel.DailyLabourersAssociationID = Convert.ToInt32(drpDailyLabourersAssociation.SelectedValue);
            ginModel.LeadInventoryController     = drpInventoryCoordinatorLoad.SelectedItem.Text;
            ginModel.CreatedBy   = BLL.UserBLL.CurrentUser.UserId;
            ginModel.NetWeight   = ginModel.PickupNoticesList.Sum(s => s.RemainingWeight) - Convert.ToDouble(Session["remainingBalance"]);
            ginModel.GINStatusID = Convert.ToInt32(GINStatusTypeEnum.New);
            ginModel.NoOfRebags  = Convert.ToDouble(txtRebag.Text);
            btnPrint.Visible     = true;
            return(true);
        }
Ejemplo n.º 26
0
        protected void btnApprove_Click(object sender, EventArgs e)
        {
            Messages.ClearMessage();
            string psaApprovalInfoXML = "<PSAApproval>";
            string errorMsg = ""; DateTime dtValue = new DateTime();

            foreach (GridViewRow gvr in this.gvApproval.Rows)
            {
                if (((CheckBox)gvr.FindControl("chkSelect")).Checked == true)
                {
                    DropDownList mStatus = (DropDownList)gvApproval.Rows[gvr.RowIndex].FindControl("drpManagerStatus");
                    if (mStatus.SelectedIndex <= 0)
                    {
                        errorMsg += "the client signed status must me selected! ";
                    }
                    TextBox mdate = (TextBox)gvApproval.Rows[gvr.RowIndex].FindControl("txtDateTimeManagerSigned");
                    TextBox mtime = (TextBox)gvApproval.Rows[gvr.RowIndex].FindControl("txtTimeManagerSigned");
                    if (!DateTime.TryParse(mdate.Text + " " + mtime.Text, out dtValue) || dtValue > DateTime.Now)
                    {
                        errorMsg += "please select current client signed date time is invalid! ";
                    }
                    if (errorMsg != string.Empty)
                    {
                        errorMsg = "For the PSA with number '" + gvr.Cells[1].Text + "' " + errorMsg;
                        Messages.SetMessage(errorMsg, WarehouseApplication.Messages.MessageType.Error);
                        return;
                    }

                    psaApprovalInfoXML +=
                        "<PSAApprovalItem> <ID>" + gvApproval.DataKeys[gvr.RowIndex].Values["Id"].ToString() + "</ID>" +
                        "<ManagerSignedDate>" + ((TextBox)gvApproval.Rows[gvr.RowIndex].FindControl("txtDateTimeManagerSigned")).Text + " " + ((TextBox)gvApproval.Rows[gvr.RowIndex].FindControl("txtTimeManagerSigned")).Text + "</ManagerSignedDate>" +
                        "<ManagerSignedName>" + BLL.UserBLL.CurrentUser.FullName + "</ManagerSignedName>" +
                        "<PSAStatusID>" + CalculatePSAStatus(gvr) + "</PSAStatusID>" +
                        "</PSAApprovalItem>";
                }
            }
            psaApprovalInfoXML += "</PSAApproval>";
            GINModel.ApproveManagerPSA(psaApprovalInfoXML);
            Messages.SetMessage("SUCCESS: The PSA Approved and it is out of unapproved list!", Messages.MessageType.Success);
            BindData();
        }
Ejemplo n.º 27
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (drpInventoryCoordinatorLoad.SelectedItem.Text == "[Select LIC]")
            {
                Messages.SetMessage("LIC not selected!!!", WarehouseApplication.Messages.MessageType.Error);
                return;
            }
            //Messages.ClearMessage();
            Session.Remove("remainingBalance");
            //StackTransactionModel sm = GetStack();

            GINModel gm = CurrentGINModel;

            string errorMessage = string.Empty;

            try
            {
                SateGIN();
                // if (gm.IsValidForPSA())
                //   {
                //  gm.AddStack(sm);
                SaveGINPSA();
                //  }
                //   else
                //   {
                //       errorMessage = gm.ErrorMessage;
                //        Messages.SetMessage(gm.ErrorMessage, WarehouseApplication.Messages.MessageType.Error);
                //    }
            }
            catch (Exception ex)
            {
                Messages.SetMessage(gm.ErrorMessage, WarehouseApplication.Messages.MessageType.Error);
            }

            UpdatePanel2.Update();
        }
Ejemplo n.º 28
0
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            int    warehouseReceipt;
            string clientId    = txtClientId.Text;
            string status      = drpStatus.SelectedItem.Value;
            string GinNo       = txtGINNo.Text;
            Guid   warehouseId = UserBLL.GetCurrentWarehouse();

            if (txtWareHouseReceipt.Text.Equals(string.Empty))
            {
                warehouseReceipt = 0;
            }
            else
            {
                warehouseReceipt = Convert.ToInt32(txtWareHouseReceipt.Text);
            }
            //List<GINModel> gmList = new List<GINModel>();
            //gmList = GINModel.SearchGIN(clientId, warehouseReceipt, status, GinNo,warehouseId);
            //gvSearchGIN.DataSource = gmList;
            //gvSearchGIN.DataBind();

            gvSearchGIN.DataSource = GINModel.SearchGIN2(clientId, warehouseReceipt, status, GinNo, warehouseId);
            gvSearchGIN.DataBind();
        }
Ejemplo n.º 29
0
        protected void gvApproval_SelectedIndexChanged(object sender, EventArgs e)
        {
            //Messages.SetMessage("gvApproval_SelectedIndexChanged", Messages.MessageType.Success);
            string   psaApprovalInfoXML = "<PSAApproval>";
            string   errorMsg           = "";
            DateTime dtValue            = new DateTime();
            DateTime dtValue1           = new DateTime();
            int      rowIndex           = gvApproval.SelectedRow.RowIndex;

            DropDownList mStatus = (DropDownList)gvApproval.Rows[rowIndex].FindControl("drpManagerStatus");

            if (mStatus.SelectedIndex <= 0)
            {
                errorMsg += "the client signed status must me selected! ";
            }
            TextBox mdate = (TextBox)gvApproval.Rows[rowIndex].FindControl("txtDateTimeManagerSigned");
            TextBox mtime = (TextBox)gvApproval.Rows[rowIndex].FindControl("txtTimeManagerSigned");

            if (!DateTime.TryParse(mdate.Text + " " + mtime.Text, out dtValue) || dtValue >= DateTime.Now)
            {
                errorMsg += "please select current manager signed date time! ";
            }
            Label lictime = (Label)gvApproval.Rows[rowIndex].FindControl("lblDateTimeLICSigned");

            if (DateTime.TryParse(mdate.Text + " " + mtime.Text, out dtValue) && DateTime.TryParse(lictime.Text, out dtValue1) &&
                dtValue < dtValue1)
            {
                errorMsg += "please select manager signed date time greater than LIC Signed Date Time!";
            }
            if (errorMsg != string.Empty)
            {
                errorMsg = "The PSA selected for approval " + errorMsg;
                Messages.SetMessage(errorMsg, WarehouseApplication.Messages.MessageType.Error);
                return;
            }

            psaApprovalInfoXML +=
                "<PSAApprovalItem> <ID>" + gvApproval.DataKeys[rowIndex].Values["Id"].ToString() + "</ID>" +
                "<ManagerSignedDate>" + ((TextBox)gvApproval.Rows[rowIndex].FindControl("txtDateTimeManagerSigned")).Text + " " + ((TextBox)gvApproval.Rows[rowIndex].FindControl("txtTimeManagerSigned")).Text + "</ManagerSignedDate>" +
                "<ManagerSignedName>" + BLL.UserBLL.CurrentUser.FullName + "</ManagerSignedName>" +
                "<PSAStatusID>" + CalculatePSAStatus(gvApproval.SelectedRow) + "</PSAStatusID>" +
                "<UserId>" + BLL.UserBLL.CurrentUser.UserId + "</UserId>" +
                "</PSAApprovalItem>";

            Label lblLICID            = (Label)gvApproval.Rows[rowIndex].FindControl("lblLICID");
            Label lblLICShedID        = (Label)gvApproval.Rows[rowIndex].FindControl("lblLICShedID");
            Label lblCommodityGradeID = (Label)gvApproval.Rows[rowIndex].FindControl("lblCommodityGradeID");
            Label lblProductionYear   = (Label)gvApproval.Rows[rowIndex].FindControl("lblProductionYear");

            psaApprovalInfoXML += "</PSAApproval>";
            int selectedStatus = Convert.ToInt32(((DropDownList)gvApproval.Rows[gvApproval.SelectedRow.RowIndex].FindControl("drpManagerStatus")).SelectedValue);

            if (selectedStatus == 11)
            {
                Session.Add("psaApprovalInfoXML", psaApprovalInfoXML);
                Response.Redirect("InventoryControlAdjustment.aspx?shedId=" + lblLICShedID.Text + "&LICID=" + lblLICID.Text + "&CGID=" + lblCommodityGradeID.Text + "&PY=" + lblProductionYear.Text);
            }
            else if (selectedStatus == 13)
            {
                GINModel.ApproveManagerPSA(psaApprovalInfoXML);
                Messages.SetMessage("SUCCESS: The PSA rejected and it is out of unapproved list!", Messages.MessageType.Success);
                BindData();
            }
        }
Ejemplo n.º 30
0
        protected void btnExport_Click(object sender, EventArgs e)
        {
            GINBussiness.GINModel dl = new GINModel();
            _dt     = dl.SearchDailyDeliveryList(txtDateFrom.Text, txtTo.Text);
            _newtbl = new DataTable();
            _newtbl.Columns.Add(new DataColumn("GINNumber", typeof(string)));
            _newtbl.Columns.Add(new DataColumn("BWHR", typeof(string)));
            _newtbl.Columns.Add(new DataColumn("GRN", typeof(string)));
            _newtbl.Columns.Add(new DataColumn("BuyerClientName", typeof(string)));
            _newtbl.Columns.Add(new DataColumn("Symbol", typeof(string)));
            _newtbl.Columns.Add(new DataColumn("PUNPrintDateTime", typeof(string)));
            _newtbl.Columns.Add(new DataColumn("DateIssued", typeof(string)));
            _newtbl.Columns.Add(new DataColumn("DateTimeLoaded", typeof(DateTime)));


            _newtbl.Columns.Add(new DataColumn("ConsignmentType", typeof(string)));
            _newtbl.Columns.Add(new DataColumn("GINCreatedDate", typeof(string)));
            _newtbl.Columns.Add(new DataColumn("TruckPlateNumber", typeof(string)));
            _newtbl.Columns.Add(new DataColumn("TrailerPlateNumber", typeof(string)));
            _newtbl.Columns.Add(new DataColumn("GINWeight", typeof(string)));
            _newtbl.Columns.Add(new DataColumn("PUNWeight", typeof(string)));
            _newtbl.Columns.Add(new DataColumn("Over/UnderDelivery", typeof(string)));

            _newtbl.Columns.Add(new DataColumn("WarehouseName", typeof(string)));
            _newtbl.Columns.Add(new DataColumn("LeadInventoryController", typeof(string)));


            _newtbl.Columns.Add(new DataColumn("AgentName", typeof(string)));
            _newtbl.Columns.Add(new DataColumn("GINStatus", typeof(string)));
            _newtbl.Columns.Add(new DataColumn("IsTraceable", typeof(string)));
            _newtbl.Columns.Add(new DataColumn("TradeDate", typeof(string)));
            _newtbl.Columns.Add(new DataColumn("IDType", typeof(string)));
            _newtbl.Columns.Add(new DataColumn("AgentIDNumber", typeof(string)));
            _newtbl.Columns.Add(new DataColumn("DriverName", typeof(string)));
            _newtbl.Columns.Add(new DataColumn("LicenseNumber", typeof(string)));
            _newtbl.Columns.Add(new DataColumn("LicenseIssuedBy", typeof(string)));
            _newtbl.Columns.Add(new DataColumn("ProductionYear", typeof(string)));
            _newtbl.Columns.Add(new DataColumn("CommodityType", typeof(string)));

            if (_dt.Rows.Count > 0)
            {
                for (int i = 0; i < _dt.Rows.Count; i++)
                {
                    DataRow row = _newtbl.NewRow();
                    row["GINNumber"]        = _dt.Rows[i]["GINNumber"];
                    row["BWHR"]             = _dt.Rows[i]["BWHR"];
                    row["GRN"]              = _dt.Rows[i]["GRN"];
                    row["BuyerClientName"]  = _dt.Rows[i]["BuyerClientName"];
                    row["Symbol"]           = _dt.Rows[i]["Symbol"];
                    row["PUNPrintDateTime"] = _dt.Rows[i]["PUNPrintDateTime"];
                    row["DateIssued"]       = _dt.Rows[i]["DateIssued"];
                    row["DateTimeLoaded"]   = _dt.Rows[i]["DateTimeLoaded"];
                    row["ConsignmentType"]  = _dt.Rows[i]["ConsignmentType"];

                    row["GINCreatedDate"]          = _dt.Rows[i]["GINCreatedDate"];
                    row["TruckPlateNumber"]        = _dt.Rows[i]["TruckPlateNumber"];
                    row["TrailerPlateNumber"]      = _dt.Rows[i]["TrailerPlateNumber"];
                    row["GINWeight"]               = _dt.Rows[i]["GINWeight"];
                    row["PUNWeight"]               = _dt.Rows[i]["PUNWeight"];
                    row["Over/UnderDelivery"]      = _dt.Rows[i]["Over/UnderDelivery"];
                    row["WarehouseName"]           = _dt.Rows[i]["WarehouseName"];
                    row["LeadInventoryController"] = _dt.Rows[i]["LeadInventoryController"];
                    row["AgentName"]               = _dt.Rows[i]["AgentName"];
                    row["GINStatus"]               = _dt.Rows[i]["GINStatus"];
                    row["IsTraceable"]             = _dt.Rows[i]["IsTraceable"];
                    row["TradeDate"]               = _dt.Rows[i]["TradeDate"];
                    row["IDType"]          = _dt.Rows[i]["IDType"];
                    row["AgentIDNumber"]   = _dt.Rows[i]["AgentIDNumber"];
                    row["DriverName"]      = _dt.Rows[i]["DriverName"];
                    row["LicenseNumber"]   = _dt.Rows[i]["LicenseNumber"];
                    row["LicenseIssuedBy"] = _dt.Rows[i]["LicenseIssuedBy"];
                    row["ProductionYear"]  = _dt.Rows[i]["ProductionYear"];
                    row["CommodityType"]   = _dt.Rows[i]["CommodityType"];

                    _newtbl.Rows.Add(row);
                }
                PrepareExcel(_newtbl);
            }
        }