Beispiel #1
0
 public Inv_PurchaseReturen GetInv_PurchaseReturenFromReader(IDataReader reader)
 {
     try
     {
         Inv_PurchaseReturen inv_PurchaseReturen = new Inv_PurchaseReturen
                                                   (
             (int)reader["Inv_PurchaseReturenID"],
             (DateTime)reader["PurchseReturenDate"],
             reader["PurchaseIDs"].ToString(),
             (int)reader["WorkSatationID"],
             reader["ExtraField1"].ToString(),
             reader["ExtraField2"].ToString(),
             reader["ExtraField3"].ToString(),
             reader["ExtraField4"].ToString(),
             reader["ExtraField5"].ToString(),
             (int)reader["AddedBy"],
             (DateTime)reader["AddedDate"],
             (int)reader["UpdatedBy"],
             (DateTime)reader["UpdatedDate"],
             (int)reader["RowStatusID"]
                                                   );
         return(inv_PurchaseReturen);
     }
     catch (Exception ex)
     {
         return(null);
     }
 }
    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        Inv_PurchaseReturen inv_PurchaseReturen = new Inv_PurchaseReturen();

        inv_PurchaseReturen = Inv_PurchaseReturenManager.GetInv_PurchaseReturenByID(Int32.Parse(Request.QueryString["inv_PurchaseReturenID"]));
        Inv_PurchaseReturen tempInv_PurchaseReturen = new Inv_PurchaseReturen();

        tempInv_PurchaseReturen.Inv_PurchaseReturenID = inv_PurchaseReturen.Inv_PurchaseReturenID;

        tempInv_PurchaseReturen.PurchseReturenDate = txtPurchseReturenDate.Text;
        tempInv_PurchaseReturen.PurchaseIDs        = Int32.Parse(ddlPurchase.SelectedValue);
        tempInv_PurchaseReturen.WorkSatationID     = Int32.Parse(ddlWorkSatation.SelectedValue);
        tempInv_PurchaseReturen.ExtraField1        = txtExtraField1.Text;
        tempInv_PurchaseReturen.ExtraField2        = txtExtraField2.Text;
        tempInv_PurchaseReturen.ExtraField3        = txtExtraField3.Text;
        tempInv_PurchaseReturen.ExtraField4        = txtExtraField4.Text;
        tempInv_PurchaseReturen.ExtraField5        = txtExtraField5.Text;
        tempInv_PurchaseReturen.AddedBy            = Int32.Parse(txtAddedBy.Text);
        tempInv_PurchaseReturen.AddedDate          = DateTime.Now;
        tempInv_PurchaseReturen.UpdatedBy          = Int32.Parse(txtUpdatedBy.Text);
        tempInv_PurchaseReturen.UpdatedDate        = txtUpdatedDate.Text;
        tempInv_PurchaseReturen.RowStatusID        = Int32.Parse(ddlRowStatus.SelectedValue);
        bool result = Inv_PurchaseReturenManager.UpdateInv_PurchaseReturen(tempInv_PurchaseReturen);

        Response.Redirect("AdminInv_PurchaseReturenDisplay.aspx");
    }
 public static Inv_PurchaseReturen GetInv_PurchaseReturenByID(int id)
 {
     Inv_PurchaseReturen inv_PurchaseReturen = new Inv_PurchaseReturen();
     SqlInv_PurchaseReturenProvider sqlInv_PurchaseReturenProvider = new SqlInv_PurchaseReturenProvider();
     inv_PurchaseReturen = sqlInv_PurchaseReturenProvider.GetInv_PurchaseReturenByID(id);
     return inv_PurchaseReturen;
 }
Beispiel #4
0
    public bool UpdateInv_PurchaseReturen(Inv_PurchaseReturen inv_PurchaseReturen)
    {
        using (SqlConnection connection = new SqlConnection(this.ConnectionString))
        {
            SqlCommand cmd = new SqlCommand("GP_UpdateInv_PurchaseReturen", connection);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@Inv_PurchaseReturenID", SqlDbType.Int).Value   = inv_PurchaseReturen.Inv_PurchaseReturenID;
            cmd.Parameters.Add("@PurchseReturenDate", SqlDbType.DateTime).Value = inv_PurchaseReturen.PurchseReturenDate;
            cmd.Parameters.Add("@PurchaseIDs", SqlDbType.NVarChar).Value        = inv_PurchaseReturen.PurchaseIDs;
            cmd.Parameters.Add("@WorkSatationID", SqlDbType.Int).Value          = inv_PurchaseReturen.WorkSatationID;
            cmd.Parameters.Add("@ExtraField1", SqlDbType.NVarChar).Value        = inv_PurchaseReturen.ExtraField1;
            cmd.Parameters.Add("@ExtraField2", SqlDbType.NVarChar).Value        = inv_PurchaseReturen.ExtraField2;
            cmd.Parameters.Add("@ExtraField3", SqlDbType.NVarChar).Value        = inv_PurchaseReturen.ExtraField3;
            cmd.Parameters.Add("@ExtraField4", SqlDbType.NVarChar).Value        = inv_PurchaseReturen.ExtraField4;
            cmd.Parameters.Add("@ExtraField5", SqlDbType.NVarChar).Value        = inv_PurchaseReturen.ExtraField5;
            cmd.Parameters.Add("@AddedBy", SqlDbType.Int).Value          = inv_PurchaseReturen.AddedBy;
            cmd.Parameters.Add("@AddedDate", SqlDbType.DateTime).Value   = inv_PurchaseReturen.AddedDate;
            cmd.Parameters.Add("@UpdatedBy", SqlDbType.Int).Value        = inv_PurchaseReturen.UpdatedBy;
            cmd.Parameters.Add("@UpdatedDate", SqlDbType.DateTime).Value = inv_PurchaseReturen.UpdatedDate;
            cmd.Parameters.Add("@RowStatusID", SqlDbType.Int).Value      = inv_PurchaseReturen.RowStatusID;
            connection.Open();

            int result = cmd.ExecuteNonQuery();
            return(result == 1);
        }
    }
Beispiel #5
0
    public static Inv_PurchaseReturen GetInv_PurchaseReturenByID(int id)
    {
        Inv_PurchaseReturen            inv_PurchaseReturen            = new Inv_PurchaseReturen();
        SqlInv_PurchaseReturenProvider sqlInv_PurchaseReturenProvider = new SqlInv_PurchaseReturenProvider();

        inv_PurchaseReturen = sqlInv_PurchaseReturenProvider.GetInv_PurchaseReturenByID(id);
        return(inv_PurchaseReturen);
    }
    private void showInv_PurchaseReturenData()
    {
        Inv_PurchaseReturen inv_PurchaseReturen = new Inv_PurchaseReturen();

        inv_PurchaseReturen = Inv_PurchaseReturenManager.GetInv_PurchaseReturenByID(Int32.Parse(Request.QueryString["inv_PurchaseReturenID"]));

        txtPurchseReturenDate.Text    = inv_PurchaseReturen.PurchseReturenDate;
        ddlPurchase.SelectedValue     = inv_PurchaseReturen.PurchaseIDs.ToString();
        ddlWorkSatation.SelectedValue = inv_PurchaseReturen.WorkSatationID.ToString();
        txtExtraField1.Text           = inv_PurchaseReturen.ExtraField1;
        txtExtraField2.Text           = inv_PurchaseReturen.ExtraField2;
        txtExtraField3.Text           = inv_PurchaseReturen.ExtraField3;
        txtExtraField4.Text           = inv_PurchaseReturen.ExtraField4;
        txtExtraField5.Text           = inv_PurchaseReturen.ExtraField5;
        txtAddedBy.Text            = inv_PurchaseReturen.AddedBy.ToString();
        txtUpdatedBy.Text          = inv_PurchaseReturen.UpdatedBy.ToString();
        txtUpdatedDate.Text        = inv_PurchaseReturen.UpdatedDate;
        ddlRowStatus.SelectedValue = inv_PurchaseReturen.RowStatusID.ToString();
    }
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        Inv_PurchaseReturen inv_PurchaseReturen = new Inv_PurchaseReturen();

        inv_PurchaseReturen.PurchseReturenDate = txtPurchseReturenDate.Text;
        inv_PurchaseReturen.PurchaseIDs        = Int32.Parse(ddlPurchase.SelectedValue);
        inv_PurchaseReturen.WorkSatationID     = Int32.Parse(ddlWorkSatation.SelectedValue);
        inv_PurchaseReturen.ExtraField1        = txtExtraField1.Text;
        inv_PurchaseReturen.ExtraField2        = txtExtraField2.Text;
        inv_PurchaseReturen.ExtraField3        = txtExtraField3.Text;
        inv_PurchaseReturen.ExtraField4        = txtExtraField4.Text;
        inv_PurchaseReturen.ExtraField5        = txtExtraField5.Text;
        inv_PurchaseReturen.AddedBy            = Int32.Parse(txtAddedBy.Text);
        inv_PurchaseReturen.AddedDate          = DateTime.Now;
        inv_PurchaseReturen.UpdatedBy          = Int32.Parse(txtUpdatedBy.Text);
        inv_PurchaseReturen.UpdatedDate        = txtUpdatedDate.Text;
        inv_PurchaseReturen.RowStatusID        = Int32.Parse(ddlRowStatus.SelectedValue);
        int resutl = Inv_PurchaseReturenManager.InsertInv_PurchaseReturen(inv_PurchaseReturen);

        Response.Redirect("AdminInv_PurchaseReturenDisplay.aspx");
    }
Beispiel #8
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();
    }
Beispiel #9
0
    private void loadData()
    {
        int ReturnID = int.Parse(Request.QueryString["ReturnID"]);
        Inv_PurchaseReturen purchaseReturn = Inv_PurchaseReturenManager.GetInv_PurchaseReturenByID(ReturnID);

        //purchase info
        lblPurchaseDate.Text     = purchaseReturn.PurchseReturenDate.ToString("dd-MMM-yyyy");
        lblPurchaseReturnID.Text = purchaseReturn.Inv_PurchaseReturenID.ToString();
        lblRefPurchaseNo.Text    = purchaseReturn.PurchaseIDs;
        lblSupplierName.Text     = purchaseReturn.ExtraField1;
        lblParticulars.Text      = purchaseReturn.ExtraField2;

        //Item Info
        List <Inv_Item> items = new List <Inv_Item>();

        items = Inv_ItemManager.GetAllInv_ItemsByPurchaseReturnID(ReturnID);

        string  htmlTable         = @" <table id='itemList_tbl' style='border:1px solid black;width:100%;' cellpadding='0' cellspacing='0'>
                        <tr id='tableHeader'>
                            <td  style='border-left:0px;'>S/L</td>
                            <td>Product Code</td>
                            <td>Product Name</td>
                            <td>Quantity</td>
                            <td>Unit</td>
                            <td>Price</td>
                            <td>Amount</td>
                        </tr>";
        int     lastRawMaterialID = 0;
        decimal Total             = 0;
        decimal Subtotal          = 0;
        decimal TotalAmount       = 0;
        decimal SubtotalAmount    = 0;
        int     serialNo          = 1;

        foreach (Inv_Item item in items)
        {
            if (lastRawMaterialID != 0 && lastRawMaterialID != item.RawMaterialID)
            {
                htmlTable += @"<tr class='subtotalRow'>
                            <td>&nbsp;</td>
                            <td>&nbsp;</td>
                            <td>Sub Total</td>
                            <td>" + Subtotal.ToString("0,0.00") + @"</td>
                            <td>&nbsp;</td>
                            <td>&nbsp;</td>
                            <td>" + SubtotalAmount.ToString("0,0.00") + @"</td>
                        </tr>";

                Subtotal       = 0;
                SubtotalAmount = 0;
            }

            if (lastRawMaterialID != item.RawMaterialID)
            {
                lastRawMaterialID = item.RawMaterialID;
                htmlTable        += @"<tr>
                            <td colspan='7' style='padding-left:50px; border-top:1px solid black;border-bottom:1px solid black;font-weight:bold;'>
                                Item: " + item.RawMaterialName + @"
                            </td>
                        </tr>";
            }

            htmlTable += @"<tr class='itemCss'>
                            <td  style='border-left:0px;'>" + (serialNo++).ToString() + @"</td>
                            <td>" + item.ItemCode + @"</td>
                            <td>" + item.ItemName + @"</td>
                            <td style='text-align:right;'>" + item.PurchasedQuantity.ToString("0,0.00") + @"</td>
                            <td >" + item.QuantityUnitName + @"</td>
                            <td style='text-align:right;'>" + item.PricePerUnit.ToString("0,0.00") + @"</td>
                            <td style='text-align:right;'>" + item.PurchasedQuantityPrice.ToString("0,0.00") + @"</td>
                        </tr>";

            Subtotal       += item.PurchasedQuantity;
            SubtotalAmount += item.PurchasedQuantityPrice;

            Total       += item.PurchasedQuantity;
            TotalAmount += item.PurchasedQuantityPrice;
        }

        htmlTable += @"<tr class='subtotalRow'>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td>Sub Total</td>
                        <td>" + Subtotal.ToString("0,0.00") + @"</td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td>" + SubtotalAmount.ToString("0,0.00") + @"</td>
                    </tr>";

        htmlTable += @"<tr id='lastRow'>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td>Grand Total</td>
                        <td>" + Total.ToString("0,0.00") + @"</td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td>" + TotalAmount.ToString("0,0.00") + @"</td>
                    </tr></table>";

        lblItemList.Text = htmlTable;
    }
 public Inv_PurchaseReturen GetInv_PurchaseReturenFromReader(IDataReader reader)
 {
     try
     {
         Inv_PurchaseReturen inv_PurchaseReturen = new Inv_PurchaseReturen
             (
                 (int)reader["Inv_PurchaseReturenID"],
                 (DateTime)reader["PurchseReturenDate"],
                 reader["PurchaseIDs"].ToString(),
                 (int)reader["WorkSatationID"],
                 reader["ExtraField1"].ToString(),
                 reader["ExtraField2"].ToString(),
                 reader["ExtraField3"].ToString(),
                 reader["ExtraField4"].ToString(),
                 reader["ExtraField5"].ToString(),
                 (int)reader["AddedBy"],
                 (DateTime)reader["AddedDate"],
                 (int)reader["UpdatedBy"],
                 (DateTime)reader["UpdatedDate"],
                 (int)reader["RowStatusID"]
             );
          return inv_PurchaseReturen;
     }
     catch(Exception ex)
     {
         return null;
     }
 }
    public bool UpdateInv_PurchaseReturen(Inv_PurchaseReturen inv_PurchaseReturen)
    {
        using (SqlConnection connection = new SqlConnection(this.ConnectionString))
        {
            SqlCommand cmd = new SqlCommand("GP_UpdateInv_PurchaseReturen", connection);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@Inv_PurchaseReturenID", SqlDbType.Int).Value = inv_PurchaseReturen.Inv_PurchaseReturenID;
            cmd.Parameters.Add("@PurchseReturenDate", SqlDbType.DateTime).Value = inv_PurchaseReturen.PurchseReturenDate;
            cmd.Parameters.Add("@PurchaseIDs", SqlDbType.NVarChar).Value = inv_PurchaseReturen.PurchaseIDs;
            cmd.Parameters.Add("@WorkSatationID", SqlDbType.Int).Value = inv_PurchaseReturen.WorkSatationID;
            cmd.Parameters.Add("@ExtraField1", SqlDbType.NVarChar).Value = inv_PurchaseReturen.ExtraField1;
            cmd.Parameters.Add("@ExtraField2", SqlDbType.NVarChar).Value = inv_PurchaseReturen.ExtraField2;
            cmd.Parameters.Add("@ExtraField3", SqlDbType.NVarChar).Value = inv_PurchaseReturen.ExtraField3;
            cmd.Parameters.Add("@ExtraField4", SqlDbType.NVarChar).Value = inv_PurchaseReturen.ExtraField4;
            cmd.Parameters.Add("@ExtraField5", SqlDbType.NVarChar).Value = inv_PurchaseReturen.ExtraField5;
            cmd.Parameters.Add("@AddedBy", SqlDbType.Int).Value = inv_PurchaseReturen.AddedBy;
            cmd.Parameters.Add("@AddedDate", SqlDbType.DateTime).Value = inv_PurchaseReturen.AddedDate;
            cmd.Parameters.Add("@UpdatedBy", SqlDbType.Int).Value = inv_PurchaseReturen.UpdatedBy;
            cmd.Parameters.Add("@UpdatedDate", SqlDbType.DateTime).Value = inv_PurchaseReturen.UpdatedDate;
            cmd.Parameters.Add("@RowStatusID", SqlDbType.Int).Value = inv_PurchaseReturen.RowStatusID;
            connection.Open();

            int result = cmd.ExecuteNonQuery();
            return result == 1;
        }
    }
    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();
    }
 public static bool UpdateInv_PurchaseReturen(Inv_PurchaseReturen inv_PurchaseReturen)
 {
     SqlInv_PurchaseReturenProvider sqlInv_PurchaseReturenProvider = new SqlInv_PurchaseReturenProvider();
     return sqlInv_PurchaseReturenProvider.UpdateInv_PurchaseReturen(inv_PurchaseReturen);
 }
 public static int InsertInv_PurchaseReturen(Inv_PurchaseReturen inv_PurchaseReturen)
 {
     SqlInv_PurchaseReturenProvider sqlInv_PurchaseReturenProvider = new SqlInv_PurchaseReturenProvider();
     return sqlInv_PurchaseReturenProvider.InsertInv_PurchaseReturen(inv_PurchaseReturen);
 }
Beispiel #15
0
    public static bool UpdateInv_PurchaseReturen(Inv_PurchaseReturen inv_PurchaseReturen)
    {
        SqlInv_PurchaseReturenProvider sqlInv_PurchaseReturenProvider = new SqlInv_PurchaseReturenProvider();

        return(sqlInv_PurchaseReturenProvider.UpdateInv_PurchaseReturen(inv_PurchaseReturen));
    }
Beispiel #16
0
    public static int InsertInv_PurchaseReturen(Inv_PurchaseReturen inv_PurchaseReturen)
    {
        SqlInv_PurchaseReturenProvider sqlInv_PurchaseReturenProvider = new SqlInv_PurchaseReturenProvider();

        return(sqlInv_PurchaseReturenProvider.InsertInv_PurchaseReturen(inv_PurchaseReturen));
    }