Esempio n. 1
0
    private void BindDeliveryItem()
    {
        DataSet ds = BLL_POLOG_Delivery.POLOG_Get_Delivery_Item_Details(UDFLib.ConvertToInteger(Request.QueryString["ID"].ToString()), UDFLib.ConvertToInteger(txtDeliveryID.Text));

        if (ds.Tables[0].Rows.Count > 0)
        {
            txtDelivery_ItemID.Text = ds.Tables[0].Rows[0]["Delivery_Item_ID"].ToString();
            // txtDeliveryID.Text = ds.Tables[0].Rows[0]["ID"].ToString();
            txtName.Text     = ds.Tables[0].Rows[0]["Delivered_Item_Name"].ToString();
            txtPoQty.Text    = ds.Tables[0].Rows[0]["POQty"].ToString();
            txtPoPrice.Text  = ds.Tables[0].Rows[0]["POprice"].ToString();
            txtConQty.Text   = ds.Tables[0].Rows[0]["DeliveryQty"].ToString();
            txtConPrice.Text = ds.Tables[0].Rows[0]["DeliveryPrice"].ToString();
            txtRemarks.Text  = ds.Tables[0].Rows[0]["Delivered_Item_Description"].ToString();

            lblPOUnit.Text           = ds.Tables[0].Rows[0]["Item_Unit"].ToString();
            lblPOCurrency.Text       = ds.Tables[0].Rows[0]["Currency"].ToString();
            txtDeliveryUnit.Text     = ds.Tables[0].Rows[0]["Delivered_Item_Unit"].ToString();
            lblDeliveryCurrency.Text = ds.Tables[0].Rows[0]["Currency"].ToString();;
        }
        else
        {
            txtName.Text    = "Non PO Item";
            txtPoQty.Text   = "0.00";
            txtPoPrice.Text = "0.00";
        }
    }
 protected void BindDeliveryDetails()
 {
     try
     {
         ChkStatus();
         DataSet ds = BLL_POLOG_Delivery.POLOG_Get_Delivery_List(UDFLib.ConvertToInteger(txtPOCode.Text), CurrStatus, UDFLib.ConvertToInteger(Session["UserID"].ToString()));
         if (ds.Tables[0].Rows.Count > 0)
         {
             divVesselDelivery.Visible   = true;
             gvVesselDelivery.DataSource = ds.Tables[0];
             gvVesselDelivery.DataBind();
         }
         else
         {
             divVesselDelivery.Visible   = false;
             gvVesselDelivery.DataSource = ds.Tables[0];
             gvVesselDelivery.DataBind();
         }
         if (ds.Tables[1].Rows.Count > 0)
         {
             divDelivery.Visible   = true;
             gvDelivery.DataSource = ds.Tables[1];
             gvDelivery.DataBind();
         }
         else
         {
             divDelivery.Visible   = false;
             gvDelivery.DataSource = ds.Tables[1];
             gvDelivery.DataBind();
         }
     }
     catch { }
     {
     }
 }
    protected void onDelete(object source, CommandEventArgs e)
    {
        HiddenField lblgrdID = (gvDeliveryItem.FindControl("lblID") as HiddenField);

        string[] arg    = e.CommandArgument.ToString().Split(',');
        int?     ItemID = UDFLib.ConvertIntegerToNull(arg[0]);
        int      retval = BLL_POLOG_Delivery.POLOG_Delete_Delivery_Item(Convert.ToInt32(ItemID), Convert.ToInt32(GetSessionUserID()));

        BindDeliveryItem();
    }
    protected void btnDelete_Click(object sender, EventArgs e)
    {
        string Action_By_Button = "DELETED";
        string DeliveryStatus   = "DELETED";
        int    retval           = BLL_POLOG_Delivery.POLOG_Delete_Delivery_Details(UDFLib.ConvertStringToNull(txtDeliveryID.Text.ToString()), UDFLib.ConvertIntegerToNull(txtSupply_ID.Text.ToString()), Action_By_Button, DeliveryStatus, UDFLib.ConvertToInteger(GetSessionUserID()));

        InsertAuditTrail("Delete Delivery", "DeleteDelivery");
        string msgDraft = String.Format("parent.ReloadParent_ByButtonID();");

        ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msgDraft", msgDraft, true);
    }
    protected void btnUnlock_Click(object sender, EventArgs e)
    {
        string Action_By_Button = "OPEN";
        string DeliveryStatus   = "OPEN";

        string retval = BLL_POLOG_Delivery.POLOG_Insert_Delivery_Details(UDFLib.ConvertStringToNull(txtDeliveryID.Text.ToString()), UDFLib.ConvertIntegerToNull(txtSupply_ID.Text.ToString()),
                                                                         Convert.ToDateTime(txtDeliveryDate.Text.Trim()), txtLocation.Text.Trim(), UDFLib.ConvertIntegerToNull(ddlPortCall.SelectedValue), txtRemarks.Text.Trim(), Action_By_Button, DeliveryStatus, UDFLib.ConvertToInteger(GetSessionUserID()));

        InsertAuditTrail("Unlock Delivery", "UnlockDelivery");
        txtDeliveryID.Text = Convert.ToString(retval);
        BindDeliveryDetails();
    }
    protected void BindDeliveryItem()
    {
        string  type = "Edit";
        DataSet ds   = BLL_POLOG_Delivery.POLOG_Get_Delivery_Item_Details(UDFLib.ConvertStringToNull(txtDeliveryID.Text.ToString()), UDFLib.ConvertToInteger(Request.QueryString["Supply_ID"].ToString()), type, UDFLib.ConvertToInteger(GetSessionUserID()));

        if (ds.Tables[0].Rows.Count > 0)
        {
            dtGridItems = ds.Tables[0];
            gvDeliveryItem.DataSource = ds.Tables[0];
            gvDeliveryItem.DataBind();
        }
        ViewState["dtGridItems"] = dtGridItems;
    }
    private void BindDeliveryDetails()
    {
        string Status = null;

        DataSet ds = BLL_POLOG_Delivery.POLOG_Get_Delivery_Details(UDFLib.ConvertStringToNull(txtDeliveryID.Text.ToString()), UDFLib.ConvertToInteger(txtSupply_ID.Text.ToString()), Status, UDFLib.ConvertToInteger(GetSessionUserID()));

        if (ds.Tables[0].Rows.Count > 0)
        {
            txtDeliveryID.Text        = ds.Tables[0].Rows[0]["Delivery_ID"].ToString();
            txtDeliveryDate.Text      = Convert.ToDateTime(ds.Tables[0].Rows[0]["Delivery_Date"].ToString()).ToString("dd/MM/yyyy");
            txtLocation.Text          = ds.Tables[0].Rows[0]["Delivery_Location"].ToString();
            ddlPortCall.SelectedValue = ds.Tables[0].Rows[0]["Port_Call_ID"].ToString();
            txtRemarks.Text           = ds.Tables[0].Rows[0]["Delivery_Remarks"].ToString();

            lblCreatedBy.Text   = ds.Tables[0].Rows[0]["Created_By"].ToString();
            lblCreateddate.Text = Convert.ToDateTime(ds.Tables[0].Rows[0]["Created_Date"].ToString()).ToString("dd MMM yyyy");
            lblDelveryID.Text   = ds.Tables[0].Rows[0]["Delivery_ID"].ToString();
            if (ds.Tables[0].Rows[0]["Delivery_Status"].ToString() == "OPEN")
            {
                btnConfirm.Enabled = true;
                btnDelete.Enabled  = true;
                btnSave.Enabled    = true;
                btnUnlock.Visible  = false;

                gvDeliveryItem.MasterTableView.Columns[7].Visible = true;
            }
            else if (ds.Tables[0].Rows[0]["Delivery_Status"].ToString() == "CONFIRMED")
            {
                btnUnlock.Visible  = true;
                btnSave.Enabled    = false;
                btnDelete.Enabled  = false;
                btnConfirm.Enabled = false;
                gvDeliveryItem.MasterTableView.Columns[7].Visible = false;
            }
            else if (ds.Tables[0].Rows[0]["Delivery_Status"].ToString() == "DELETED")
            {
                btnUnlock.Visible  = false;
                btnSave.Enabled    = false;
                btnDelete.Enabled  = false;
                btnConfirm.Enabled = false;
                gvDeliveryItem.MasterTableView.Columns[7].Visible = false;
            }

            lblCreatedBy.Visible   = true;
            lblCreateddate.Visible = true;
            lblDelveryID.Visible   = true;
            Label1.Visible         = true;
            lblCreated.Visible     = true;
            Label2.Visible         = true;
        }
    }
    //protected void btnAdd_Click(object sender, EventArgs e)
    //{
    //    this.SetFocus("txtLocation");
    //    txtDeliveryID.Text = null;
    //    string str = "Add";
    //    txtDeliveryDate.Text = DateTime.Now.ToString("dd/MM/yyyy");
    //    btnSave.Enabled = true;
    //    BindPortCall();
    //    BindDeliveryItemDetails(str);
    //    OperationMode = "Delivery Deatils";
    //    string AddUserTypemodal = String.Format("showModal('divadd',false);");
    //    ScriptManager.RegisterStartupScript(Page, Page.GetType(), "AddUserTypemodal", AddUserTypemodal, true);
    //}
    //protected void ImgUpdate_Click(object s, CommandEventArgs e)
    //{
    //    string[] arg = e.CommandArgument.ToString().Split(',');
    //    txtDeliveryID.Text = UDFLib.ConvertStringToNull(arg[0]);
    //    txtDeliveryDate.Text = DateTime.Now.ToString("dd/MM/yyyy");

    //    string str = "Edit";
    //    BindPortCall();
    //    BindDeliveryItemDetails(str);
    //    OperationMode = "Delivery Deatils";
    //    string AddUserTypemodal = String.Format("showModal('divadd',false);");
    //    ScriptManager.RegisterStartupScript(Page, Page.GetType(), "AddUserTypemodal", AddUserTypemodal, true);
    //}
    protected void ImgDelete_Click(object s, CommandEventArgs e)
    {
        string[] arg       = e.CommandArgument.ToString().Split(',');
        int?     RemarksID = UDFLib.ConvertIntegerToNull(arg[0]);

        txtDeliveryID.Text = UDFLib.ConvertStringToNull(arg[0]);
        string Action_By_Button = "DELETED";
        string DeliveryStatus   = "DELETED";
        int    retval           = BLL_POLOG_Delivery.POLOG_Delete_Delivery_Details(UDFLib.ConvertStringToNull(txtDeliveryID.Text.ToString()), UDFLib.ConvertIntegerToNull(txtPOCode.Text.ToString()), Action_By_Button, DeliveryStatus, UDFLib.ConvertToInteger(GetSessionUserID()));
        // InsertAuditTrail("Delete Delivery", "DeleteDelivery");
        int RetAuditVal = BLL_POLOG_Register.POLOG_Insert_Transactionlog(UDFLib.ConvertStringToNull(txtDeliveryID.Text), "Delete Delivery", "DeleteDelivery", UDFLib.ConvertToInteger(GetSessionUserID()));

        BindDeliveryDetails();
    }
Esempio n. 9
0
    protected void btnDraft_Click(object sender, EventArgs e)
    {
        try
        {
            //string Confirm_Unit = "PC";
            int retval = BLL_POLOG_Delivery.POLog_Insert_Delivery_Item(UDFLib.ConvertIntegerToNull(Request.QueryString["ID"].ToString()), UDFLib.ConvertIntegerToNull(txtDeliveryID.Text),
                                                                       txtName.Text.Trim(), UDFLib.ConvertDecimalToNull(txtPoQty.Text.Trim()), UDFLib.ConvertDecimalToNull(txtPoPrice.Text.Trim()), txtDeliveryUnit.Text,
                                                                       UDFLib.ConvertDecimalToNull(txtConQty.Text.Trim()), UDFLib.ConvertDecimalToNull(txtConPrice.Text.Trim()), txtRemarks.Text.Trim(), UDFLib.ConvertToInteger(GetSessionUserID()));


            string msgDraft = String.Format("parent.ReloadParent_ByButtonID();");
            ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msgDraft", msgDraft, true);
        }
        catch
        {
        }
    }
    protected void btnConfirm_Click(object sender, EventArgs e)
    {
        string Action_By_Button = "CONFIRMED";
        string DeliveryStatus   = "CONFIRMED";

        string retval = BLL_POLOG_Delivery.POLOG_Insert_Delivery_Details(UDFLib.ConvertStringToNull(txtDeliveryID.Text.ToString()), UDFLib.ConvertIntegerToNull(txtSupply_ID.Text.ToString()),
                                                                         Convert.ToDateTime(txtDeliveryDate.Text.Trim()), txtLocation.Text.Trim(), UDFLib.ConvertIntegerToNull(ddlPortCall.SelectedValue), txtRemarks.Text.Trim(), Action_By_Button, DeliveryStatus, UDFLib.ConvertToInteger(GetSessionUserID()));

        txtDeliveryID.Text = retval;
        saveval();
        InsertAuditTrail("Confirm Delivery", "ConfirmDelivery");
        string msg2 = String.Format("alert('Delivery Record Confirmed.')");

        ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msg", msg2, true);
        BindDeliveryDetails();
        BindDeliveryItem();
    }
    private void saveval()
    {
        StringBuilder strIDVals         = new StringBuilder();
        StringBuilder strItemdesciption = new StringBuilder();
        StringBuilder stritemUnits      = new StringBuilder();
        StringBuilder strItemRequestQty = new StringBuilder();
        StringBuilder strItemComments   = new StringBuilder();
        StringBuilder strUnitPrice      = new StringBuilder();
        StringBuilder strDiscount       = new StringBuilder();
        StringBuilder strSuppCode       = new StringBuilder();
        StringBuilder strBgtCode        = new StringBuilder();
        StringBuilder ItemRefCode       = new StringBuilder();

        int i = 0;

        DataTable dtExtraItems = new DataTable();

        dtExtraItems.Columns.Add("pkid");
        dtExtraItems.Columns.Add("Order_Item_ID");
        dtExtraItems.Columns.Add("POQty");
        dtExtraItems.Columns.Add("POPrice");
        dtExtraItems.Columns.Add("DeliveryQty");
        dtExtraItems.Columns.Add("DeliveryPrice");
        dtExtraItems.Columns.Add("Delivered_Unit");
        dtExtraItems.Columns.Add("Currency");
        dtExtraItems.Columns.Add("Item_Description");
        dtExtraItems.Columns.Add("Delivered_Item_Description");
        dtExtraItems.Columns.Add("Invoiced");



        // dtExtraItems.Columns.Add("BGT_CODE");

        int inc = 1;

        foreach (GridDataItem dataItem in gvDeliveryItem.MasterTableView.Items)
        {
            HiddenField lblgrdID            = (dataItem.FindControl("lblID") as HiddenField);
            HiddenField lblOrderItemID      = (dataItem.FindControl("lblOrderItemID") as HiddenField);
            Label       lblPOQty            = (dataItem.FindControl("lblPOQty") as Label);
            Label       lblPOprice          = (dataItem.FindControl("lblPOprice") as Label);
            TextBox     txtDeliveryQty      = (dataItem.FindControl("txtDeliveryQty") as TextBox);
            TextBox     txtDeliveryprice    = (dataItem.FindControl("txtDeliveryprice") as TextBox);
            Label       lblUnit             = (dataItem.FindControl("lblUnit") as Label);
            Label       lblPOCurrency       = (dataItem.FindControl("lblPOCurrency") as Label);
            Label       lblPODesc           = (dataItem.FindControl("lblPODesc") as Label);
            TextBox     txtItem_Description = (dataItem.FindControl("txtItem_Description") as TextBox);
            Label       lblInvoiced         = (dataItem.FindControl("lblInvoiced") as Label);

            //if (txtgrdItemReqQty.Text.Length > 0 && txtItemDescription.Text.Length > 0)
            //{
            DataRow dritem = dtExtraItems.NewRow();
            dritem["pkid"]                       = lblgrdID.Value;
            dritem["Order_Item_ID"]              = lblOrderItemID.Value;
            dritem["POQty"]                      = lblPOQty.Text.ToString();
            dritem["POPrice"]                    = lblPOprice.Text.ToString();
            dritem["DeliveryQty"]                = (txtDeliveryQty.Text.Trim() == "" ? "0" : txtDeliveryQty.Text.Trim());
            dritem["DeliveryPrice"]              = txtDeliveryprice.Text.ToString();
            dritem["Delivered_Unit"]             = lblUnit.Text.ToString();
            dritem["Currency"]                   = lblPOCurrency.Text.ToString();
            dritem["Item_Description"]           = lblPODesc.Text.ToString();
            dritem["Delivered_Item_Description"] = txtItem_Description.Text.ToString();
            dritem["Invoiced"]                   = lblInvoiced.Text.ToString();
            dtExtraItems.Rows.Add(dritem);
            inc++;

            //}
        }

        int retval = 0;

        if (dtExtraItems.Rows.Count > 0)
        {
            retval = BLL_POLOG_Delivery.POLog_Insert_Delivery_Item(UDFLib.ConvertStringToNull(txtDeliveryID.Text.ToString()), UDFLib.ConvertIntegerToNull(txtSupply_ID.Text.ToString()), dtExtraItems, UDFLib.ConvertIntegerToNull(Session["USERID"].ToString()));
        }
        //else
        //{
        //    string msg2 = String.Format("alert('Please Select Atleast one row.')");
        //    ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msg", msg2, true);
        //}
    }