protected void btnAdd_Click(object sender, EventArgs e)
    {
        Inv_IssueMaster inv_IssueMaster = new Inv_IssueMaster();

        inv_IssueMaster.IssueName      = txtIssueName.Text;
        inv_IssueMaster.IssueDate      = txtIssueDate.Text;
        inv_IssueMaster.EmployeeID     = Int32.Parse(ddlEmployee.SelectedValue);
        inv_IssueMaster.WorkSatationID = Int32.Parse(ddlWorkSatation.SelectedValue);
        inv_IssueMaster.Particulars    = txtParticulars.Text;
        inv_IssueMaster.IsIssue        = cbIsIssue.Checked;
        inv_IssueMaster.ExtraField1    = txtExtraField1.Text;
        inv_IssueMaster.ExtraField2    = txtExtraField2.Text;
        inv_IssueMaster.ExtraField3    = txtExtraField3.Text;
        inv_IssueMaster.ExtraField4    = txtExtraField4.Text;
        inv_IssueMaster.ExtraField5    = txtExtraField5.Text;
        inv_IssueMaster.AddedBy        = getLogin().LoginID;
        inv_IssueMaster.AddedDate      = DateTime.Now;
        inv_IssueMaster.UpdatedBy      = getLogin().LoginID;
        inv_IssueMaster.UpdatedDate    = DateTime.Now;
        inv_IssueMaster.RowStatusID    = 1;
        int resutl = Inv_IssueMasterManager.InsertInv_IssueMaster(inv_IssueMaster);

        Response.Redirect("AdminInv_IssueMasterDisplay.aspx");
    }
Exemplo n.º 2
0
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        if (!checking())
        {
            return;
        }

        Inv_IssueMaster inv_IssueMaster = new Inv_IssueMaster();

        inv_IssueMaster.IssueName      = "";
        inv_IssueMaster.IssueDate      = DateTime.Parse(txtIssueDate.Text);
        inv_IssueMaster.EmployeeID     = Int32.Parse(ddlEmployee.SelectedValue);
        inv_IssueMaster.WorkSatationID = Int32.Parse(ddlWorkSatation.SelectedValue);
        inv_IssueMaster.Particulars    = txtParticulars.Text;
        inv_IssueMaster.IsIssue        = (Request.QueryString["IsNonProduction"] != null ? false : true);
        inv_IssueMaster.ExtraField1    = "";
        inv_IssueMaster.ExtraField2    = "";
        inv_IssueMaster.ExtraField3    = "";
        inv_IssueMaster.ExtraField4    = "";
        inv_IssueMaster.ExtraField5    = "";
        inv_IssueMaster.AddedBy        = getLogin().LoginID;
        inv_IssueMaster.AddedDate      = DateTime.Now;
        inv_IssueMaster.UpdatedBy      = getLogin().LoginID;
        inv_IssueMaster.UpdatedDate    = DateTime.Now;
        inv_IssueMaster.RowStatusID    = 1;

        if (txtOldIssueID.Text == "")
        {
            inv_IssueMaster.Inv_IssueMasterID = Inv_IssueMasterManager.InsertInv_IssueMaster(inv_IssueMaster);
        }
        else
        {
            inv_IssueMaster.Inv_IssueMasterID = int.Parse(txtOldIssueID.Text);
        }
        int JournalMasterID = 0;

        foreach (GridViewRow gvr in gvInv_Item.Rows)
        {
            HiddenField  hfInv_ItemID           = (HiddenField)gvr.FindControl("hfInv_ItemID");
            Label        lblPurchaseID          = (Label)gvr.FindControl("lblPurchaseID");
            TextBox      txtIssueQuantity       = (TextBox)gvr.FindControl("txtIssueQuantity");
            TextBox      txtApproximateQuantity = (TextBox)gvr.FindControl("txtApproximateQuantity");
            DropDownList ddlProduct             = (DropDownList)gvr.FindControl("ddlProduct");
            HiddenField  hfRawMaterialTypeID    = (HiddenField)gvr.FindControl("hfRawMaterialTypeID");

            if (hfRawMaterialTypeID.Value == "10" && JournalMasterID == 0)
            {
                if (ddlWorkSatation.SelectedValue != "1")
                {
                    //Journal Entry
                    ACC_JournalMaster aCC_JournalMaster = new ACC_JournalMaster();

                    aCC_JournalMaster.JournalMasterName = "3";//Journal Voucher
                    aCC_JournalMaster.ExtraField1       = ddlWorkSatation.SelectedItem.Text;
                    aCC_JournalMaster.ExtraField2       = "";
                    aCC_JournalMaster.ExtraField3       = "";
                    aCC_JournalMaster.Note        = "Inventory Issue-" + inv_IssueMaster.Inv_IssueMasterID.ToString();
                    aCC_JournalMaster.JournalDate = DateTime.Parse(txtIssueDate.Text);
                    aCC_JournalMaster.AddedBy     = getLogin().LoginID;
                    aCC_JournalMaster.AddedDate   = DateTime.Now;
                    aCC_JournalMaster.UpdatedBy   = getLogin().LoginID;
                    aCC_JournalMaster.UpdatedDate = DateTime.Now;
                    aCC_JournalMaster.RowStatusID = 1;

                    JournalMasterID = ACC_JournalMasterManager.InsertACC_JournalMaster(aCC_JournalMaster);
                }
            }

            Label lblAvailableQuantity = (Label)gvr.FindControl("lblExtraFieldQuantity1");

            if (txtIssueQuantity.Text != "0" && txtIssueQuantity.Text != "")
            {
                Inv_IssueDetail inv_IssueDetail = new Inv_IssueDetail();
                inv_IssueDetail.ItemID    = Int32.Parse(hfInv_ItemID.Value);
                inv_IssueDetail.Quantity  = Decimal.Parse(txtIssueQuantity.Text);
                inv_IssueDetail.ProductID = Int32.Parse(ddlProduct.SelectedValue);
                inv_IssueDetail.AdditionalWithIssueDetailID = 0;
                inv_IssueDetail.ApproximateQuantity         = Int32.Parse(txtApproximateQuantity.Text);

                inv_IssueDetail.ExtraField1 = txtIssueQuantity.Text;
                inv_IssueDetail.ExtraField2 = "0";
                inv_IssueDetail.ExtraField3 = "0";
                inv_IssueDetail.ExtraField4 = (hfRawMaterialTypeID.Value == "10"?JournalMasterID.ToString():"0");
                inv_IssueDetail.ExtraField5 = inv_IssueMaster.Inv_IssueMasterID.ToString();

                inv_IssueDetail.AddedBy     = getLogin().LoginID;
                inv_IssueDetail.AddedDate   = DateTime.Now;
                inv_IssueDetail.UpdatedBy   = getLogin().LoginID;
                inv_IssueDetail.UpdatedDate = DateTime.Now;
                inv_IssueDetail.RowStatusID = 1;
                if (Inv_IssueDetailManager.InsertInv_IssueDetail(inv_IssueDetail) <= 0)
                {
                    showAlartMessage("Double Pressed");
                    return;
                }
            }
        }

        hlnkIssuePrint.NavigateUrl = "IssuePrint.aspx?IssueID=" + inv_IssueMaster.Inv_IssueMasterID.ToString();
        hlnkIssuePrint.Visible     = true;

        showInv_IssueDetailGrid();
    }
Exemplo n.º 3
0
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        //if(Request.QueryString["IsNonProduction"] == null)
        //addConfiguration();

        if (Request.QueryString["IsNonProduction"] != null)
        {
            txtApproximateQuantity.Text = txtQuantity.Text;
        }

        if (hfInv_IssueMasterID.Value == "0" || hfInv_IssueMasterID.Value == "")
        {
            Inv_IssueMaster inv_IssueMaster = new Inv_IssueMaster();

            inv_IssueMaster.IssueName      = "";
            inv_IssueMaster.IssueDate      = DateTime.Parse(txtIssueDate.Text);
            inv_IssueMaster.EmployeeID     = Int32.Parse(ddlEmployee.SelectedValue);
            inv_IssueMaster.WorkSatationID = Int32.Parse(ddlWorkSatation.SelectedValue);
            inv_IssueMaster.Particulars    = txtParticulars.Text;
            inv_IssueMaster.IsIssue        = (Request.QueryString["IsNonProduction"] != null ?false:true);
            inv_IssueMaster.ExtraField1    = "";
            inv_IssueMaster.ExtraField2    = "";
            inv_IssueMaster.ExtraField3    = "";
            inv_IssueMaster.ExtraField4    = "";
            inv_IssueMaster.ExtraField5    = "";
            inv_IssueMaster.AddedBy        = getLogin().LoginID;
            inv_IssueMaster.AddedDate      = DateTime.Now;
            inv_IssueMaster.UpdatedBy      = getLogin().LoginID;
            inv_IssueMaster.UpdatedDate    = DateTime.Now;
            inv_IssueMaster.RowStatusID    = 1;
            hfInv_IssueMasterID.Value      = Inv_IssueMasterManager.InsertInv_IssueMaster(inv_IssueMaster).ToString();
        }

        Inv_IssueDetail inv_IssueDetail = new Inv_IssueDetail();

        inv_IssueDetail.ItemID    = Int32.Parse(ddlItem.SelectedValue);
        inv_IssueDetail.Quantity  = Decimal.Parse(txtQuantity.Text);
        inv_IssueDetail.ProductID = Int32.Parse(ddlProduct.SelectedValue);
        if (ddlIssuedItem.Items.Count == 0 || ddlIssuedItem.SelectedValue == "0")
        {
            inv_IssueDetail.AdditionalWithIssueDetailID = 0;
            inv_IssueDetail.ApproximateQuantity         = Int32.Parse(txtApproximateQuantity.Text);
        }
        else
        {
            inv_IssueDetail.AdditionalWithIssueDetailID = int.Parse(ddlIssuedItem.SelectedValue);
            inv_IssueDetail.ApproximateQuantity         = 0;
        }

        //inv_IssueDetail.ExtraField1 = ddlItem.SelectedItem.Text.Split(' ')[0]; //Item COde
        //inv_IssueDetail.ExtraField2 = ddlItem.SelectedItem.Text.Split('{')[0].Trim().Replace(inv_IssueDetail.ExtraField1 +" - ","");//item Name
        //inv_IssueDetail.ExtraField3 = ddlItem.SelectedItem.Text.Split('{')[1].Split('}')[0];//quality
        //inv_IssueDetail.ExtraField4 = Request.QueryString["IsNonProduction"] != null ?"":ddlProduct.SelectedItem.Text;//productName
        //inv_IssueDetail.ExtraField5 = Inv_ItemManager.GetInv_ItemByID(Int32.Parse(ddlItem.SelectedValue)).PricePerUnit.ToString("0,0.00");//Price Per unit
        inv_IssueDetail.ExtraField1 = txtQuantity.Text;
        inv_IssueDetail.ExtraField2 = "0";
        inv_IssueDetail.ExtraField3 = "0";
        inv_IssueDetail.ExtraField4 = "0";
        inv_IssueDetail.ExtraField5 = hfInv_IssueMasterID.Value;

        inv_IssueDetail.AddedBy     = getLogin().LoginID;
        inv_IssueDetail.AddedDate   = DateTime.Now;
        inv_IssueDetail.UpdatedBy   = getLogin().LoginID;
        inv_IssueDetail.UpdatedDate = DateTime.Now;
        inv_IssueDetail.RowStatusID = 1;
        Inv_IssueDetailManager.InsertInv_IssueDetail(inv_IssueDetail);
        showInv_IssueDetailGrid();
        //btnClear_Click(this, new EventArgs());
    }