Example #1
0
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        Inv_ItemTransaction inv_ItemTransaction = new Inv_ItemTransaction();

        inv_ItemTransaction.ItemID               = Int32.Parse(ddlItem.SelectedValue);
        inv_ItemTransaction.Quantity             = Decimal.Parse(txtQuantity.Text);
        inv_ItemTransaction.ItemTrasactionTypeID = Int32.Parse(ddlItemTrasactionType.SelectedValue);
        inv_ItemTransaction.ReferenceID          = Int32.Parse(ddlReference.SelectedValue);
        inv_ItemTransaction.ExtraField1          = txtExtraField1.Text;
        inv_ItemTransaction.ExtraField2          = txtExtraField2.Text;
        inv_ItemTransaction.ExtraField3          = txtExtraField3.Text;
        inv_ItemTransaction.ExtraField4          = txtExtraField4.Text;
        inv_ItemTransaction.ExtraField5          = txtExtraField5.Text;
        inv_ItemTransaction.AddedBy              = getLogin().LoginID;
        inv_ItemTransaction.AddedDate            = DateTime.Now;
        inv_ItemTransaction.UpdatedBy            = getLogin().LoginID;
        inv_ItemTransaction.UpdatedDate          = DateTime.Now;
        inv_ItemTransaction.RowStatusID          = 1;
        int resutl = Inv_ItemTransactionManager.InsertInv_ItemTransaction(inv_ItemTransaction);

        Response.Redirect("AdminInv_ItemTransactionDisplay.aspx");
    }
Example #2
0
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        int purchaseReturnID = 0;
        Inv_PurchaseReturen inv_PurchaseReturen = new Inv_PurchaseReturen();

        inv_PurchaseReturen.PurchseReturenDate = DateTime.Parse(txtPurchaseReturnDate.Text);
        inv_PurchaseReturen.PurchaseIDs        = getPurchaseIDs(true);
        inv_PurchaseReturen.WorkSatationID     = 2;
        inv_PurchaseReturen.ExtraField1        = ddlSuppier.SelectedValue;
        inv_PurchaseReturen.ExtraField2        = txtNote.Text;
        inv_PurchaseReturen.ExtraField3        = "";
        inv_PurchaseReturen.ExtraField4        = "";
        inv_PurchaseReturen.ExtraField5        = "";
        inv_PurchaseReturen.AddedBy            = getLogin().LoginID;
        inv_PurchaseReturen.AddedDate          = DateTime.Now;
        inv_PurchaseReturen.UpdatedBy          = getLogin().LoginID;
        inv_PurchaseReturen.UpdatedDate        = DateTime.Now;
        inv_PurchaseReturen.RowStatusID        = 1;

        int purchaseAdjustmentID = 0;
        Inv_PurchaseAdjustment inv_PurchaseAdjustment = new Inv_PurchaseAdjustment();

        inv_PurchaseAdjustment.PurchseAdjustmentDate = DateTime.Parse(txtPurchaseReturnDate.Text);
        inv_PurchaseAdjustment.PurchaseIDs           = getPurchaseIDs(false);
        inv_PurchaseAdjustment.WorkSatationID        = 2;
        inv_PurchaseAdjustment.ExtraField1           = ddlSuppier.SelectedValue;
        inv_PurchaseAdjustment.ExtraField2           = txtNote.Text;
        inv_PurchaseAdjustment.ExtraField3           = "";
        inv_PurchaseAdjustment.ExtraField4           = "";
        inv_PurchaseAdjustment.ExtraField5           = "";
        inv_PurchaseAdjustment.AddedBy     = getLogin().LoginID;
        inv_PurchaseAdjustment.AddedDate   = DateTime.Now;
        inv_PurchaseAdjustment.UpdatedBy   = getLogin().LoginID;
        inv_PurchaseAdjustment.UpdatedDate = DateTime.Now;
        inv_PurchaseAdjustment.RowStatusID = 1;


        foreach (GridViewRow gvr in gvInv_Item.Rows)
        {
            HiddenField hfInv_ItemID          = (HiddenField)gvr.FindControl("hfInv_ItemID");
            Label       lblPurchaseID         = (Label)gvr.FindControl("lblPurchaseID");
            TextBox     txtReturnQuantity     = (TextBox)gvr.FindControl("txtReturnQuantity");
            TextBox     txtAdjustmentQuantity = (TextBox)gvr.FindControl("txtAdjustmentQuantity");

            if (txtReturnQuantity.Text != "0")
            {
                if (purchaseReturnID == 0)
                {
                    purchaseReturnID = Inv_PurchaseReturenManager.InsertInv_PurchaseReturen(inv_PurchaseReturen);
                }

                Inv_ItemTransaction inv_ItemTransaction = new Inv_ItemTransaction();

                inv_ItemTransaction.ItemID               = Int32.Parse(hfInv_ItemID.Value);
                inv_ItemTransaction.Quantity             = Decimal.Parse(txtReturnQuantity.Text);
                inv_ItemTransaction.ItemTrasactionTypeID = 1;//purchase return
                inv_ItemTransaction.ReferenceID          = purchaseReturnID;
                inv_ItemTransaction.ExtraField1          = "";
                inv_ItemTransaction.ExtraField2          = "";
                inv_ItemTransaction.ExtraField3          = "";
                inv_ItemTransaction.ExtraField4          = "";
                inv_ItemTransaction.ExtraField5          = "";
                inv_ItemTransaction.AddedBy              = getLogin().LoginID;
                inv_ItemTransaction.AddedDate            = DateTime.Now;
                inv_ItemTransaction.UpdatedBy            = getLogin().LoginID;
                inv_ItemTransaction.UpdatedDate          = DateTime.Parse(txtPurchaseReturnDate.Text);
                inv_ItemTransaction.RowStatusID          = 1;
                int resutl = Inv_ItemTransactionManager.InsertInv_ItemTransaction(inv_ItemTransaction);
            }

            if (txtAdjustmentQuantity.Text != "0")
            {
                if (purchaseAdjustmentID == 0)
                {
                    purchaseAdjustmentID = Inv_PurchaseAdjustmentManager.InsertInv_PurchaseAdjustment(inv_PurchaseAdjustment);
                }

                Inv_ItemTransaction inv_ItemTransaction = new Inv_ItemTransaction();

                inv_ItemTransaction.ItemID               = Int32.Parse(hfInv_ItemID.Value);
                inv_ItemTransaction.Quantity             = Decimal.Parse(txtAdjustmentQuantity.Text);
                inv_ItemTransaction.ItemTrasactionTypeID = 7;//Adjustment
                inv_ItemTransaction.ReferenceID          = purchaseAdjustmentID;
                inv_ItemTransaction.ExtraField1          = "";
                inv_ItemTransaction.ExtraField2          = "";
                inv_ItemTransaction.ExtraField3          = "";
                inv_ItemTransaction.ExtraField4          = "";
                inv_ItemTransaction.ExtraField5          = "";
                inv_ItemTransaction.AddedBy              = getLogin().LoginID;
                inv_ItemTransaction.AddedDate            = DateTime.Now;
                inv_ItemTransaction.UpdatedBy            = getLogin().LoginID;
                inv_ItemTransaction.UpdatedDate          = DateTime.Parse(txtPurchaseReturnDate.Text);
                inv_ItemTransaction.RowStatusID          = 1;
                int resutl = Inv_ItemTransactionManager.InsertInv_ItemTransaction(inv_ItemTransaction);
            }
        }

        if (purchaseReturnID != 0)
        {
            hlnkPurchasePrint.NavigateUrl = "PurchaseReturnPrint.aspx?ReturnID=" + purchaseReturnID.ToString();
            hlnkPurchasePrint.Visible     = true;
        }

        if (purchaseAdjustmentID != 0)
        {
            hlnkAdjustmentPrint.NavigateUrl = "AdjustmentPrint.aspx?AdjustmentID=" + purchaseAdjustmentID.ToString();
            hlnkAdjustmentPrint.Visible     = true;
        }


        showInv_IssueDetailGrid();
    }