Example #1
0
 public Pos_Transaction GetPos_TransactionFromReader(IDataReader reader)
 {
     try
     {
         Pos_Transaction pos_Transaction = new Pos_Transaction
                                           (
             (int)reader["Pos_TransactionID"],
             (int)reader["Pos_ProductID"],
             (decimal)reader["Quantity"],
             (int)reader["Pos_ProductTrasactionTypeID"],
             (int)reader["Pos_ProductTransactionMasterID"],
             (int)reader["WorkStationID"],
             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(pos_Transaction);
     }
     catch (Exception ex)
     {
         return(null);
     }
 }
Example #2
0
    public bool UpdatePos_Transaction(Pos_Transaction pos_Transaction)
    {
        using (SqlConnection connection = new SqlConnection(this.ConnectionString))
        {
            SqlCommand cmd = new SqlCommand("GP_UpdatePos_Transaction", connection);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@Pos_TransactionID", SqlDbType.Int).Value              = pos_Transaction.Pos_TransactionID;
            cmd.Parameters.Add("@Pos_ProductID", SqlDbType.Int).Value                  = pos_Transaction.Pos_ProductID;
            cmd.Parameters.Add("@Quantity", SqlDbType.Decimal).Value                   = pos_Transaction.Quantity;
            cmd.Parameters.Add("@Pos_ProductTrasactionTypeID", SqlDbType.Int).Value    = pos_Transaction.Pos_ProductTrasactionTypeID;
            cmd.Parameters.Add("@Pos_ProductTransactionMasterID", SqlDbType.Int).Value = pos_Transaction.Pos_ProductTransactionMasterID;
            cmd.Parameters.Add("@WorkStationID", SqlDbType.Int).Value                  = pos_Transaction.WorkStationID;
            cmd.Parameters.Add("@ExtraField1", SqlDbType.NVarChar).Value               = pos_Transaction.ExtraField1;
            cmd.Parameters.Add("@ExtraField2", SqlDbType.NVarChar).Value               = pos_Transaction.ExtraField2;
            cmd.Parameters.Add("@ExtraField3", SqlDbType.NVarChar).Value               = pos_Transaction.ExtraField3;
            cmd.Parameters.Add("@ExtraField4", SqlDbType.NVarChar).Value               = pos_Transaction.ExtraField4;
            cmd.Parameters.Add("@ExtraField5", SqlDbType.NVarChar).Value               = pos_Transaction.ExtraField5;
            cmd.Parameters.Add("@AddedBy", SqlDbType.Int).Value          = pos_Transaction.AddedBy;
            cmd.Parameters.Add("@AddedDate", SqlDbType.DateTime).Value   = pos_Transaction.AddedDate;
            cmd.Parameters.Add("@UpdatedBy", SqlDbType.Int).Value        = pos_Transaction.UpdatedBy;
            cmd.Parameters.Add("@UpdatedDate", SqlDbType.DateTime).Value = pos_Transaction.UpdatedDate;
            cmd.Parameters.Add("@RowStatusID", SqlDbType.Int).Value      = pos_Transaction.RowStatusID;
            connection.Open();

            int result = cmd.ExecuteNonQuery();
            return(result == 1);
        }
    }
Example #3
0
 public static Pos_Transaction GetPos_TransactionByID(int id)
 {
     Pos_Transaction pos_Transaction = new Pos_Transaction();
     SqlPos_TransactionProvider sqlPos_TransactionProvider = new SqlPos_TransactionProvider();
     pos_Transaction = sqlPos_TransactionProvider.GetPos_TransactionByID(id);
     return pos_Transaction;
 }
    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        Pos_Transaction pos_Transaction = new Pos_Transaction();

        pos_Transaction = Pos_TransactionManager.GetPos_TransactionByID(Int32.Parse(Request.QueryString["pos_TransactionID"]));
        Pos_Transaction tempPos_Transaction = new Pos_Transaction();

        tempPos_Transaction.Pos_TransactionID = pos_Transaction.Pos_TransactionID;

        tempPos_Transaction.Pos_ProductID = Int32.Parse(ddlPos_Product.SelectedValue);
        tempPos_Transaction.Quantity      = Decimal.Parse(txtQuantity.Text);
        tempPos_Transaction.Pos_ProductTrasactionTypeID    = Int32.Parse(ddlPos_ProductTrasactionType.SelectedValue);
        tempPos_Transaction.Pos_ProductTransactionMasterID = Int32.Parse(ddlPos_ProductTransactionMaster.SelectedValue);
        tempPos_Transaction.WorkStationID = Int32.Parse(ddlWorkStation.SelectedValue);
        tempPos_Transaction.ExtraField1   = txtExtraField1.Text;
        tempPos_Transaction.ExtraField2   = txtExtraField2.Text;
        tempPos_Transaction.ExtraField3   = txtExtraField3.Text;
        tempPos_Transaction.ExtraField4   = txtExtraField4.Text;
        tempPos_Transaction.ExtraField5   = txtExtraField5.Text;
        tempPos_Transaction.AddedBy       = Int32.Parse(txtAddedBy.Text);
        tempPos_Transaction.AddedDate     = DateTime.Now;
        tempPos_Transaction.UpdatedBy     = Int32.Parse(txtUpdatedBy.Text);
        tempPos_Transaction.UpdatedDate   = txtUpdatedDate.Text;
        tempPos_Transaction.RowStatusID   = Int32.Parse(ddlRowStatus.SelectedValue);
        bool result = Pos_TransactionManager.UpdatePos_Transaction(tempPos_Transaction);

        Response.Redirect("AdminPos_TransactionDisplay.aspx");
    }
    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        Pos_Transaction pos_Transaction = new Pos_Transaction();
        pos_Transaction = Pos_TransactionManager.GetPos_TransactionByID(Int32.Parse(Request.QueryString["pos_TransactionID"]));
        Pos_Transaction tempPos_Transaction = new Pos_Transaction();
        tempPos_Transaction.Pos_TransactionID = pos_Transaction.Pos_TransactionID;

        tempPos_Transaction.Pos_ProductID = Int32.Parse(ddlPos_Product.SelectedValue);
        tempPos_Transaction.Quantity = Decimal.Parse(txtQuantity.Text);
        tempPos_Transaction.Pos_ProductTrasactionTypeID = Int32.Parse(ddlPos_ProductTrasactionType.SelectedValue);
        tempPos_Transaction.Pos_ProductTransactionMasterID = Int32.Parse(ddlPos_ProductTransactionMaster.SelectedValue);
        tempPos_Transaction.WorkStationID = Int32.Parse(ddlWorkStation.SelectedValue);
        tempPos_Transaction.ExtraField1 = txtExtraField1.Text;
        tempPos_Transaction.ExtraField2 = txtExtraField2.Text;
        tempPos_Transaction.ExtraField3 = txtExtraField3.Text;
        tempPos_Transaction.ExtraField4 = txtExtraField4.Text;
        tempPos_Transaction.ExtraField5 = txtExtraField5.Text;
        tempPos_Transaction.AddedBy = Int32.Parse(txtAddedBy.Text);
        tempPos_Transaction.AddedDate = DateTime.Now;
        tempPos_Transaction.UpdatedBy = Int32.Parse(txtUpdatedBy.Text);
        tempPos_Transaction.UpdatedDate = txtUpdatedDate.Text;
        tempPos_Transaction.RowStatusID = Int32.Parse(ddlRowStatus.SelectedValue);
        bool result = Pos_TransactionManager.UpdatePos_Transaction(tempPos_Transaction);
        Response.Redirect("AdminPos_TransactionDisplay.aspx");
    }
Example #6
0
    public static Pos_Transaction GetPos_TransactionByID(int id)
    {
        Pos_Transaction            pos_Transaction            = new Pos_Transaction();
        SqlPos_TransactionProvider sqlPos_TransactionProvider = new SqlPos_TransactionProvider();

        pos_Transaction = sqlPos_TransactionProvider.GetPos_TransactionByID(id);
        return(pos_Transaction);
    }
    private void showPos_TransactionData()
    {
        Pos_Transaction pos_Transaction = new Pos_Transaction();

        pos_Transaction = Pos_TransactionManager.GetPos_TransactionByID(Int32.Parse(Request.QueryString["pos_TransactionID"]));

        ddlPos_Product.SelectedValue = pos_Transaction.Pos_ProductID.ToString();
        txtQuantity.Text             = pos_Transaction.Quantity.ToString();
        ddlPos_ProductTrasactionType.SelectedValue    = pos_Transaction.Pos_ProductTrasactionTypeID.ToString();
        ddlPos_ProductTransactionMaster.SelectedValue = pos_Transaction.Pos_ProductTransactionMasterID.ToString();
        ddlWorkStation.SelectedValue = pos_Transaction.WorkStationID.ToString();
        txtExtraField1.Text          = pos_Transaction.ExtraField1;
        txtExtraField2.Text          = pos_Transaction.ExtraField2;
        txtExtraField3.Text          = pos_Transaction.ExtraField3;
        txtExtraField4.Text          = pos_Transaction.ExtraField4;
        txtExtraField5.Text          = pos_Transaction.ExtraField5;
        txtAddedBy.Text            = pos_Transaction.AddedBy.ToString();
        txtUpdatedBy.Text          = pos_Transaction.UpdatedBy.ToString();
        txtUpdatedDate.Text        = pos_Transaction.UpdatedDate;
        ddlRowStatus.SelectedValue = pos_Transaction.RowStatusID.ToString();
    }
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        Pos_Transaction pos_Transaction = new Pos_Transaction();

        pos_Transaction.Pos_ProductID = Int32.Parse(ddlPos_Product.SelectedValue);
        pos_Transaction.Quantity = Decimal.Parse(txtQuantity.Text);
        pos_Transaction.Pos_ProductTrasactionTypeID = Int32.Parse(ddlPos_ProductTrasactionType.SelectedValue);
        pos_Transaction.Pos_ProductTransactionMasterID = Int32.Parse(ddlPos_ProductTransactionMaster.SelectedValue);
        pos_Transaction.WorkStationID = Int32.Parse(ddlWorkStation.SelectedValue);
        pos_Transaction.ExtraField1 = txtExtraField1.Text;
        pos_Transaction.ExtraField2 = txtExtraField2.Text;
        pos_Transaction.ExtraField3 = txtExtraField3.Text;
        pos_Transaction.ExtraField4 = txtExtraField4.Text;
        pos_Transaction.ExtraField5 = txtExtraField5.Text;
        pos_Transaction.AddedBy = Int32.Parse(txtAddedBy.Text);
        pos_Transaction.AddedDate = DateTime.Now;
        pos_Transaction.UpdatedBy = Int32.Parse(txtUpdatedBy.Text);
        pos_Transaction.UpdatedDate = txtUpdatedDate.Text;
        pos_Transaction.RowStatusID = Int32.Parse(ddlRowStatus.SelectedValue);
        int resutl = Pos_TransactionManager.InsertPos_Transaction(pos_Transaction);
        Response.Redirect("AdminPos_TransactionDisplay.aspx");
    }
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        Pos_Transaction pos_Transaction = new Pos_Transaction();

        pos_Transaction.Pos_ProductID = Int32.Parse(ddlPos_Product.SelectedValue);
        pos_Transaction.Quantity      = Decimal.Parse(txtQuantity.Text);
        pos_Transaction.Pos_ProductTrasactionTypeID    = Int32.Parse(ddlPos_ProductTrasactionType.SelectedValue);
        pos_Transaction.Pos_ProductTransactionMasterID = Int32.Parse(ddlPos_ProductTransactionMaster.SelectedValue);
        pos_Transaction.WorkStationID = Int32.Parse(ddlWorkStation.SelectedValue);
        pos_Transaction.ExtraField1   = txtExtraField1.Text;
        pos_Transaction.ExtraField2   = txtExtraField2.Text;
        pos_Transaction.ExtraField3   = txtExtraField3.Text;
        pos_Transaction.ExtraField4   = txtExtraField4.Text;
        pos_Transaction.ExtraField5   = txtExtraField5.Text;
        pos_Transaction.AddedBy       = Int32.Parse(txtAddedBy.Text);
        pos_Transaction.AddedDate     = DateTime.Now;
        pos_Transaction.UpdatedBy     = Int32.Parse(txtUpdatedBy.Text);
        pos_Transaction.UpdatedDate   = txtUpdatedDate.Text;
        pos_Transaction.RowStatusID   = Int32.Parse(ddlRowStatus.SelectedValue);
        int resutl = Pos_TransactionManager.InsertPos_Transaction(pos_Transaction);

        Response.Redirect("AdminPos_TransactionDisplay.aspx");
    }
Example #10
0
 public Pos_Transaction GetPos_TransactionFromReader(IDataReader reader)
 {
     try
     {
         Pos_Transaction pos_Transaction = new Pos_Transaction
             (
                 (int)reader["Pos_TransactionID"],
                 (int)reader["Pos_ProductID"],
                 (decimal)reader["Quantity"],
                 (int)reader["Pos_ProductTrasactionTypeID"],
                 (int)reader["Pos_ProductTransactionMasterID"],
                 (int)reader["WorkStationID"],
                 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 pos_Transaction;
     }
     catch(Exception ex)
     {
         return null;
     }
 }
Example #11
0
    public bool UpdatePos_Transaction(Pos_Transaction pos_Transaction)
    {
        using (SqlConnection connection = new SqlConnection(this.ConnectionString))
        {
            SqlCommand cmd = new SqlCommand("GP_UpdatePos_Transaction", connection);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@Pos_TransactionID", SqlDbType.Int).Value = pos_Transaction.Pos_TransactionID;
            cmd.Parameters.Add("@Pos_ProductID", SqlDbType.Int).Value = pos_Transaction.Pos_ProductID;
            cmd.Parameters.Add("@Quantity", SqlDbType.Decimal).Value = pos_Transaction.Quantity;
            cmd.Parameters.Add("@Pos_ProductTrasactionTypeID", SqlDbType.Int).Value = pos_Transaction.Pos_ProductTrasactionTypeID;
            cmd.Parameters.Add("@Pos_ProductTransactionMasterID", SqlDbType.Int).Value = pos_Transaction.Pos_ProductTransactionMasterID;
            cmd.Parameters.Add("@WorkStationID", SqlDbType.Int).Value = pos_Transaction.WorkStationID;
            cmd.Parameters.Add("@ExtraField1", SqlDbType.NVarChar).Value = pos_Transaction.ExtraField1;
            cmd.Parameters.Add("@ExtraField2", SqlDbType.NVarChar).Value = pos_Transaction.ExtraField2;
            cmd.Parameters.Add("@ExtraField3", SqlDbType.NVarChar).Value = pos_Transaction.ExtraField3;
            cmd.Parameters.Add("@ExtraField4", SqlDbType.NVarChar).Value = pos_Transaction.ExtraField4;
            cmd.Parameters.Add("@ExtraField5", SqlDbType.NVarChar).Value = pos_Transaction.ExtraField5;
            cmd.Parameters.Add("@AddedBy", SqlDbType.Int).Value = pos_Transaction.AddedBy;
            cmd.Parameters.Add("@AddedDate", SqlDbType.DateTime).Value = pos_Transaction.AddedDate;
            cmd.Parameters.Add("@UpdatedBy", SqlDbType.Int).Value = pos_Transaction.UpdatedBy;
            cmd.Parameters.Add("@UpdatedDate", SqlDbType.DateTime).Value = pos_Transaction.UpdatedDate;
            cmd.Parameters.Add("@RowStatusID", SqlDbType.Int).Value = pos_Transaction.RowStatusID;
            connection.Open();

            int result = cmd.ExecuteNonQuery();
            return result == 1;
        }
    }
Example #12
0
 public static bool UpdatePos_Transaction(Pos_Transaction pos_Transaction)
 {
     SqlPos_TransactionProvider sqlPos_TransactionProvider = new SqlPos_TransactionProvider();
     return sqlPos_TransactionProvider.UpdatePos_Transaction(pos_Transaction);
 }
Example #13
0
 public static int InsertPos_TransactionWithOpositeEntry(Pos_Transaction pos_Transaction)
 {
     SqlPos_TransactionProvider sqlPos_TransactionProvider = new SqlPos_TransactionProvider();
     return sqlPos_TransactionProvider.InsertPos_TransactionWithOpositeEntry(pos_Transaction);
 }
Example #14
0
 public static int InsertPos_Transaction(Pos_Transaction pos_Transaction)
 {
     SqlPos_TransactionProvider sqlPos_TransactionProvider = new SqlPos_TransactionProvider();
     return sqlPos_TransactionProvider.InsertPos_Transaction(pos_Transaction);
 }
Example #15
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        if (ddlWorkStation.SelectedValue == "0")
        {
            showAlartMessage("Please select the Work Station");
            return;
        }
        if (Request.QueryString["TransactionTypeID"] == "15")
        {
            ddlWorkStation.SelectedValue = "1";
            if (ddlRefference.SelectedValue == "0")
            {
                showAlartMessage("Please select the Work Station or Ref");
                return;
            }
        }
        if (gvPos_Product.Rows.Count == 0)
        {
            showAlartMessage("Plz add some product");
            return;
        }
        foreach (GridViewRow gvr in gvPos_Product.Rows)
        {
            Label   lblBarCode = (Label)gvr.FindControl("lblBarCode");
            TextBox txtQty     = (TextBox)gvr.FindControl("txtQty");
            Label   lblStock   = (Label)gvr.FindControl("lblStock");

            if (decimal.Parse(lblStock.Text) < decimal.Parse(txtQty.Text))
            {
                showAlartMessage(lblBarCode.Text + " is going to issue more than stock. pleae enter the correct value");
                return;
            }
        }
        btnSubmit.Visible = false;

        int transactionTypeID = int.Parse(Request.QueryString["TransactionTypeID"]);

        int TransactionMasterID = 0;

        if (txtOldTransactionID.Text != "")
        {
            if (txtOldTransactionID.Text != "0")
            {
                TransactionMasterID = int.Parse(GetTransactionMasterID());
            }
            else
            {
                TransactionMasterID = int.Parse(txtOldTransactionID.Text);
            }

            if (TransactionMasterID == 0)
            {
                showAlartMessage("Wrong old ID");
                return;
            }
        }
        else
        {
            Pos_TransactionMaster pos_TransactionMaster = new Pos_TransactionMaster();

            pos_TransactionMaster.TransactionDate       = DateTime.Parse(txtDate.Text);
            pos_TransactionMaster.TransactionID         = 0;
            pos_TransactionMaster.Pos_TransactionTypeID = transactionTypeID;
            pos_TransactionMaster.ToOrFromID            = int.Parse(ddlWorkStation.SelectedValue);
            pos_TransactionMaster.Record         = "";
            pos_TransactionMaster.Particulars    = "";
            pos_TransactionMaster.WorkSatationID = 1;
            pos_TransactionMaster.ExtraField1    = "";
            pos_TransactionMaster.ExtraField2    = "";
            pos_TransactionMaster.ExtraField3    = "";
            pos_TransactionMaster.ExtraField4    = "";
            pos_TransactionMaster.ExtraField5    = (transactionTypeID == 9? "Pending":"");
            pos_TransactionMaster.AddedBy        = getLogin().LoginID;
            pos_TransactionMaster.AddedDate      = DateTime.Now;
            pos_TransactionMaster.UpdatedBy      = getLogin().LoginID;
            pos_TransactionMaster.UpdatedDate    = DateTime.Now;
            pos_TransactionMaster.RowStatusID    = 1;
            TransactionMasterID   = Pos_TransactionMasterManager.InsertPos_TransactionMaster(pos_TransactionMaster);
            pos_TransactionMaster = Pos_TransactionMasterManager.GetPos_TransactionMasterByID(TransactionMasterID);

            txtOldTransactionID.Text = pos_TransactionMaster.TransactionID.ToString();
        }

        string sql = "Declare @Count int; ";

        foreach (GridViewRow gvr in gvPos_Product.Rows)
        {
            HiddenField hfPos_ProductID = (HiddenField)gvr.FindControl("hfPos_ProductID");
            TextBox     txtQty          = (TextBox)gvr.FindControl("txtQty");
            Label       lblStock        = (Label)gvr.FindControl("lblStock");

            if (txtQty.Text == "")
            {
                continue;
            }
            if (decimal.Parse(txtQty.Text) == 0)
            {
                continue;
            }
            if (decimal.Parse(lblStock.Text) < decimal.Parse(txtQty.Text))
            {
                txtQty.Text = lblStock.Text;
            }

            Pos_Transaction pos_Transaction = new Pos_Transaction();

            pos_Transaction.Pos_ProductID = Int32.Parse(hfPos_ProductID.Value);
            pos_Transaction.Quantity      = Decimal.Parse(txtQty.Text);
            pos_Transaction.Pos_ProductTrasactionTypeID    = transactionTypeID;
            pos_Transaction.Pos_ProductTransactionMasterID = TransactionMasterID;
            pos_Transaction.WorkStationID = Int32.Parse(ddlWorkStation.SelectedValue);
            pos_Transaction.ExtraField1   = "";
            pos_Transaction.ExtraField2   = "";
            pos_Transaction.ExtraField3   = "";
            pos_Transaction.ExtraField4   = "";
            pos_Transaction.ExtraField5   = "";
            pos_Transaction.AddedBy       = getLogin().LoginID;
            pos_Transaction.AddedDate     = DateTime.Now;
            pos_Transaction.UpdatedBy     = getLogin().LoginID;
            pos_Transaction.UpdatedDate   = DateTime.Now;
            pos_Transaction.RowStatusID   = 1;
            int resutl = Pos_TransactionManager.InsertPos_Transaction(pos_Transaction);


            bool IsGeneralOperation = false;
            //accounts need to update
            switch (transactionTypeID)
            {
            case 9:     //Issue
                IsGeneralOperation = true;
                break;

            case 5:     //Adjustment -
                IsGeneralOperation = true;
                break;

            case 6:     //Adjustment +
                IsGeneralOperation = true;
                break;

            default:
                break;
            }

            if (IsGeneralOperation)
            {
                Pos_TransactionType transactionType = Pos_TransactionTypeManager.GetPos_TransactionTypeByID(transactionTypeID);

                if (transactionType.CentralStockFormula != "0")
                {
                    sql += "Update Pos_Product set ExtraField1 =(cast(ExtraField1 as decimal(10,2)) + ((" + transactionType.CentralStockFormula + ")*" + txtQty.Text + ")) where Pos_ProductID=" + pos_Transaction.Pos_ProductID.ToString() + ";";
                }

                /*
                 * Any thing will be send to another place need the accepting from the receiver
                 * if (transactionType.ShowRoomFormula != "0")
                 * {
                 *  sql += @"
                 *          set @Count=
                 *          (
                 *          select COUNT(*) from Pos_WorkStationStock
                 *          where ProductID=" + pos_Transaction.Pos_ProductID.ToString() + @" and WorkStationID="+ddlWorkStation.SelectedValue+@"
                 *          )
                 *
                 *          if @Count = 0
                 *          BEGIN
                 *                  INSERT INTO [Pos_WorkStationStock]
                 *                     ([WorkStationID]
                 *                     ,[ProductID]
                 *                     ,[Stock])
                 *                     VALUES(" + ddlWorkStation.SelectedValue + @"," + pos_Transaction.Pos_ProductID.ToString() + @"," + txtQty.Text + @");
                 *          END
                 *          ELSE
                 *          BEGIN
                 *              Update Pos_WorkStationStock set Stock += ((" + transactionType.ShowRoomFormula + @")*" + txtQty.Text + @") where ProductID=" + pos_Transaction.Pos_ProductID.ToString() + @";
                 *          END;";
                 * }
                 */
            }
        }

        saveForRemoteDatabase(TransactionMasterID);

        CommonManager.SQLExec(sql);
        btnSearch_Click(this, new EventArgs());
        hlnkProductionPrint.Visible     = true;
        hlnkProductionPrint.NavigateUrl = (Request.QueryString["TransactionTypeID"] == "9" ? "DelivaryChalanPrint" : "TransactionPrint") + ".aspx?Pos_TransactionMasterID=" + TransactionMasterID.ToString();
    }
Example #16
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        if (ddlWorkStation.SelectedValue == "0")
        {
            showAlartMessage("Please select the Work Station");
            return;
        }
        if (Request.QueryString["TransactionTypeID"] == "15")
        {
            ddlWorkStation.SelectedValue = "1";
            if (ddlRefference.SelectedValue == "0")
            {
                showAlartMessage("Please select the Work Station or Ref");
                return;
            }
        }
        if (gvPos_Product.Rows.Count == 0)
        {
            showAlartMessage("Plz add some product");
            return;
        }
        foreach (GridViewRow gvr in gvPos_Product.Rows)
        {
            Label lblBarCode = (Label)gvr.FindControl("lblBarCode");
            TextBox txtQty = (TextBox)gvr.FindControl("txtQty");
            Label lblStock = (Label)gvr.FindControl("lblStock");

            if (decimal.Parse(lblStock.Text) < decimal.Parse(txtQty.Text))
            {
                showAlartMessage(lblBarCode.Text + " is going to issue more than stock. pleae enter the correct value");
                return;
            }
        }
        btnSubmit.Visible = false;

        int transactionTypeID = int.Parse(Request.QueryString["TransactionTypeID"]);

        int TransactionMasterID = 0;
        if (txtOldTransactionID.Text != "")
        {
            if (txtOldTransactionID.Text  != "0")
            {
                TransactionMasterID = int.Parse(GetTransactionMasterID());
            }
            else
            {
                TransactionMasterID = int.Parse(txtOldTransactionID.Text);
            }

            if (TransactionMasterID == 0)
            {
                showAlartMessage("Wrong old ID");
                return;
            }
        }
        else
        {
            Pos_TransactionMaster pos_TransactionMaster = new Pos_TransactionMaster();

            pos_TransactionMaster.TransactionDate = DateTime.Parse(txtDate.Text);
            pos_TransactionMaster.TransactionID = 0;
            pos_TransactionMaster.Pos_TransactionTypeID = transactionTypeID;
            pos_TransactionMaster.ToOrFromID = int.Parse(ddlWorkStation.SelectedValue);
            pos_TransactionMaster.Record = "";
            pos_TransactionMaster.Particulars = "";
            pos_TransactionMaster.WorkSatationID = 1;
            pos_TransactionMaster.ExtraField1 = "";
            pos_TransactionMaster.ExtraField2 = "";
            pos_TransactionMaster.ExtraField3 = "";
            pos_TransactionMaster.ExtraField4 = "";
            pos_TransactionMaster.ExtraField5 = (transactionTypeID == 9? "Pending":"");
            pos_TransactionMaster.AddedBy = getLogin().LoginID;
            pos_TransactionMaster.AddedDate = DateTime.Now;
            pos_TransactionMaster.UpdatedBy = getLogin().LoginID;
            pos_TransactionMaster.UpdatedDate = DateTime.Now;
            pos_TransactionMaster.RowStatusID = 1;
            TransactionMasterID = Pos_TransactionMasterManager.InsertPos_TransactionMaster(pos_TransactionMaster);
            pos_TransactionMaster = Pos_TransactionMasterManager.GetPos_TransactionMasterByID(TransactionMasterID);

            txtOldTransactionID.Text = pos_TransactionMaster.TransactionID.ToString();
        }

        string sql = "Declare @Count int; ";

        foreach (GridViewRow gvr in gvPos_Product.Rows)
        {
            HiddenField hfPos_ProductID = (HiddenField)gvr.FindControl("hfPos_ProductID");
            TextBox txtQty = (TextBox)gvr.FindControl("txtQty");
            Label lblStock = (Label)gvr.FindControl("lblStock");

            if (txtQty.Text == "")
                continue;
            if (decimal.Parse(txtQty.Text) == 0)
                continue;
            if (decimal.Parse(lblStock.Text) < decimal.Parse(txtQty.Text))
            {
                txtQty.Text = lblStock.Text;
            }

            Pos_Transaction pos_Transaction = new Pos_Transaction();

            pos_Transaction.Pos_ProductID = Int32.Parse(hfPos_ProductID.Value);
            pos_Transaction.Quantity = Decimal.Parse(txtQty.Text);
            pos_Transaction.Pos_ProductTrasactionTypeID = transactionTypeID;
            pos_Transaction.Pos_ProductTransactionMasterID = TransactionMasterID;
            pos_Transaction.WorkStationID = Int32.Parse(ddlWorkStation.SelectedValue);
            pos_Transaction.ExtraField1 = "";
            pos_Transaction.ExtraField2 = "";
            pos_Transaction.ExtraField3 = "";
            pos_Transaction.ExtraField4 = "";
            pos_Transaction.ExtraField5 = "";
            pos_Transaction.AddedBy = getLogin().LoginID;
            pos_Transaction.AddedDate = DateTime.Now;
            pos_Transaction.UpdatedBy = getLogin().LoginID;
            pos_Transaction.UpdatedDate = DateTime.Now;
            pos_Transaction.RowStatusID = 1;
            int resutl = Pos_TransactionManager.InsertPos_Transaction(pos_Transaction);

            bool IsGeneralOperation = false;
            //accounts need to update
            switch (transactionTypeID)
            {
                case 9: //Issue
                    IsGeneralOperation = true;
                    break;

                case 5: //Adjustment -
                    IsGeneralOperation = true;
                    break;

                case 6: //Adjustment +
                    IsGeneralOperation = true;
                    break;

                default:
                    break;
            }

            if (IsGeneralOperation)
            {
                Pos_TransactionType transactionType = Pos_TransactionTypeManager.GetPos_TransactionTypeByID(transactionTypeID);

                if (transactionType.CentralStockFormula != "0")
                {
                    sql += "Update Pos_Product set ExtraField1 =(cast(ExtraField1 as decimal(10,2)) + ((" + transactionType.CentralStockFormula + ")*" + txtQty.Text + ")) where Pos_ProductID=" + pos_Transaction.Pos_ProductID.ToString() + ";";
                }

                /*
                 * Any thing will be send to another place need the accepting from the receiver
                if (transactionType.ShowRoomFormula != "0")
                {
                    sql += @"
                            set @Count=
                            (
                            select COUNT(*) from Pos_WorkStationStock
                            where ProductID=" + pos_Transaction.Pos_ProductID.ToString() + @" and WorkStationID="+ddlWorkStation.SelectedValue+@"
                            )

                            if @Count = 0
                            BEGIN
                                INSERT INTO [Pos_WorkStationStock]
                                       ([WorkStationID]
                                       ,[ProductID]
                                       ,[Stock])
                                       VALUES(" + ddlWorkStation.SelectedValue + @"," + pos_Transaction.Pos_ProductID.ToString() + @"," + txtQty.Text + @");
                            END
                            ELSE
                            BEGIN
                                Update Pos_WorkStationStock set Stock += ((" + transactionType.ShowRoomFormula + @")*" + txtQty.Text + @") where ProductID=" + pos_Transaction.Pos_ProductID.ToString() + @";
                            END;";
                }
                 */
            }
        }

        saveForRemoteDatabase(TransactionMasterID);

        CommonManager.SQLExec(sql);
        btnSearch_Click(this, new EventArgs());
        hlnkProductionPrint.Visible = true;
        hlnkProductionPrint.NavigateUrl = (Request.QueryString["TransactionTypeID"] == "9" ? "DelivaryChalanPrint" : "TransactionPrint") + ".aspx?Pos_TransactionMasterID=" + TransactionMasterID.ToString();
    }
Example #17
0
    public static int InsertPos_Transaction(Pos_Transaction pos_Transaction)
    {
        SqlPos_TransactionProvider sqlPos_TransactionProvider = new SqlPos_TransactionProvider();

        return(sqlPos_TransactionProvider.InsertPos_Transaction(pos_Transaction));
    }
Example #18
0
    public static int InsertPos_TransactionWithOpositeEntry(Pos_Transaction pos_Transaction)
    {
        SqlPos_TransactionProvider sqlPos_TransactionProvider = new SqlPos_TransactionProvider();

        return(sqlPos_TransactionProvider.InsertPos_TransactionWithOpositeEntry(pos_Transaction));
    }
    private void showPos_TransactionData()
    {
        Pos_Transaction pos_Transaction = new Pos_Transaction();
        pos_Transaction = Pos_TransactionManager.GetPos_TransactionByID(Int32.Parse(Request.QueryString["pos_TransactionID"]));

        ddlPos_Product.SelectedValue = pos_Transaction.Pos_ProductID.ToString();
        txtQuantity.Text = pos_Transaction.Quantity.ToString();
        ddlPos_ProductTrasactionType.SelectedValue = pos_Transaction.Pos_ProductTrasactionTypeID.ToString();
        ddlPos_ProductTransactionMaster.SelectedValue = pos_Transaction.Pos_ProductTransactionMasterID.ToString();
        ddlWorkStation.SelectedValue = pos_Transaction.WorkStationID.ToString();
        txtExtraField1.Text = pos_Transaction.ExtraField1;
        txtExtraField2.Text = pos_Transaction.ExtraField2;
        txtExtraField3.Text = pos_Transaction.ExtraField3;
        txtExtraField4.Text = pos_Transaction.ExtraField4;
        txtExtraField5.Text = pos_Transaction.ExtraField5;
        txtAddedBy.Text = pos_Transaction.AddedBy.ToString();
        txtUpdatedBy.Text = pos_Transaction.UpdatedBy.ToString();
        txtUpdatedDate.Text = pos_Transaction.UpdatedDate;
        ddlRowStatus.SelectedValue = pos_Transaction.RowStatusID.ToString();
    }
Example #20
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        int transactionTypeID = int.Parse(Request.QueryString["TransactionTypeID"]);

        int TransactionMasterID = 0;

        bool IsIssueReturn = false;
        bool isTransferToanotherShowroom = false;
        bool isAdjustment = false;
        string Pending = "Pending";
        switch (transactionTypeID)
        {
            case 10: //Issue Return
                IsIssueReturn = true;
                break;

            case 11: //Transfer to another showroom
                isTransferToanotherShowroom = true;
                break;

            case 23: //Adjustment +
                isAdjustment = true;
                Pending = "";
                break;
            case 24: //Adjustment +
                isAdjustment = true;
                Pending = "";
                break;
            default:
                break;
        }

        if (txtOldTransactionID.Text != "")
        {
            if (txtOldTransactionID.Text  != "0")
            {
                TransactionMasterID = int.Parse(GetTransactionMasterID());
            }
            else
            {
                TransactionMasterID = int.Parse(txtOldTransactionID.Text);
            }

            if (TransactionMasterID == 0)
            {
                showAlartMessage("Wrong old ID");
                return;
            }
        }
        else
        {
            Pos_TransactionMaster pos_TransactionMaster = new Pos_TransactionMaster();
            Pos_TransactionMaster pos_TransactionMasterOposite = new Pos_TransactionMaster();

            pos_TransactionMaster.TransactionDate = DateTime.Parse(txtDate.Text);
            pos_TransactionMaster.TransactionID = 0;
            pos_TransactionMaster.Pos_TransactionTypeID = transactionTypeID;
            pos_TransactionMaster.ToOrFromID =(isAdjustment?int.Parse(ddlWorkStationSearch.SelectedValue): int.Parse(ddlWorkStation.SelectedValue));
            pos_TransactionMaster.Record = "";
            pos_TransactionMaster.Particulars = "";
            pos_TransactionMaster.WorkSatationID = int.Parse(ddlWorkStationSearch.SelectedValue);
            pos_TransactionMaster.ExtraField1 = "";
            pos_TransactionMaster.ExtraField2 = "";
            pos_TransactionMaster.ExtraField3 = "";
            pos_TransactionMaster.ExtraField4 = "";
            pos_TransactionMaster.ExtraField5 = Pending;
            pos_TransactionMaster.AddedBy = getLogin().LoginID;
            pos_TransactionMaster.AddedDate = DateTime.Now;
            pos_TransactionMaster.UpdatedBy = getLogin().LoginID;
            pos_TransactionMaster.UpdatedDate = DateTime.Now;
            pos_TransactionMaster.RowStatusID = 1;
            if (isTransferToanotherShowroom)
            {
                TransactionMasterID = Pos_TransactionMasterManager.InsertPos_TransactionMaster(pos_TransactionMaster,true);
            }
            else
            {
                TransactionMasterID = Pos_TransactionMasterManager.InsertPos_TransactionMaster(pos_TransactionMaster);
            }

            pos_TransactionMaster = Pos_TransactionMasterManager.GetPos_TransactionMasterByID(TransactionMasterID);

            txtOldTransactionID.Text = pos_TransactionMaster.TransactionID.ToString();
        }

        string sql = "Declare @Count int; ";

        foreach (GridViewRow gvr in gvPos_Product.Rows)
        {
            HiddenField hfPos_ProductID = (HiddenField)gvr.FindControl("hfPos_ProductID");
            TextBox txtQty = (TextBox)gvr.FindControl("txtQty");

            if (txtQty.Text == "")
                continue;
            if (decimal.Parse(txtQty.Text) == 0)
                continue;

            Pos_Transaction pos_Transaction = new Pos_Transaction();

            pos_Transaction.Pos_ProductID = Int32.Parse(hfPos_ProductID.Value);
            pos_Transaction.Quantity = Decimal.Parse(txtQty.Text);
            pos_Transaction.Pos_ProductTrasactionTypeID = transactionTypeID;
            pos_Transaction.Pos_ProductTransactionMasterID = TransactionMasterID;
            pos_Transaction.WorkStationID = Int32.Parse(ddlWorkStationSearch.SelectedValue);
            pos_Transaction.ExtraField1 = "";
            pos_Transaction.ExtraField2 = "";
            pos_Transaction.ExtraField3 = "";
            pos_Transaction.ExtraField4 = "";
            pos_Transaction.ExtraField5 = "";
            pos_Transaction.AddedBy = getLogin().LoginID;
            pos_Transaction.AddedDate = DateTime.Now;
            pos_Transaction.UpdatedBy = getLogin().LoginID;
            pos_Transaction.UpdatedDate = DateTime.Now;
            pos_Transaction.RowStatusID = 1;

            if (isTransferToanotherShowroom)
            {
                Pos_TransactionManager.InsertPos_TransactionWithOpositeEntry(pos_Transaction);
            }
            else
            {
                Pos_TransactionManager.InsertPos_Transaction(pos_Transaction);
            }

            if (IsIssueReturn)
            {
                Pos_TransactionType transactionType = Pos_TransactionTypeManager.GetPos_TransactionTypeByID(transactionTypeID);

                if (transactionType.CentralStockFormula != "0")
                {
                    //sql += "Update Pos_Product set ExtraField1 =(cast(ExtraField1 as decimal(10,2)) + ((" + transactionType.CentralStockFormula + ")*" + txtQty.Text + ")) where Pos_ProductID=" + pos_Transaction.Pos_ProductID.ToString() + ";";
                }

                if (transactionType.ShowRoomFormula != "0")
                {
                    sql += @"
                            set @Count=
                            (
                            select COUNT(*) from Pos_WorkStationStock
                            where ProductID=" + pos_Transaction.Pos_ProductID.ToString() + @" and WorkStationID="+ddlWorkStationSearch.SelectedValue+@"
                            )

                            if @Count = 0
                            BEGIN
                                INSERT INTO [Pos_WorkStationStock]
                                       ([WorkStationID]
                                       ,[ProductID]
                                       ,[Stock])
                                       VALUES(" + ddlWorkStationSearch.SelectedValue + @"," + pos_Transaction.Pos_ProductID.ToString() + @"," + txtQty.Text + @");
                            END
                            ELSE
                            BEGIN
                                Update Pos_WorkStationStock set Stock += ((" + transactionType.ShowRoomFormula + @")*" + txtQty.Text + @") where  WorkStationID=" + ddlWorkStationSearch.SelectedValue + @" and ProductID=" + pos_Transaction.Pos_ProductID.ToString() + @";
                            END;";
                }
            }

            if (isTransferToanotherShowroom)
            {
                Pos_TransactionType transactionType = Pos_TransactionTypeManager.GetPos_TransactionTypeByID(transactionTypeID);

                if (transactionType.ShowRoomFormula != "0")
                {
                    sql += @"/*
                            set @Count=
                            (
                            select COUNT(*) from Pos_WorkStationStock
                            where ProductID=" + pos_Transaction.Pos_ProductID.ToString() + @" and WorkStationID=" + ddlWorkStationSearch.SelectedValue + @"
                            )

                            if @Count = 0
                            BEGIN
                                INSERT INTO [Pos_WorkStationStock]
                                       ([WorkStationID]
                                       ,[ProductID]
                                       ,[Stock])
                                       VALUES(" + ddlWorkStationSearch.SelectedValue + @"," + pos_Transaction.Pos_ProductID.ToString() + @"," + txtQty.Text + @");
                            END
                            ELSE
                            BEGIN
                                Update Pos_WorkStationStock set Stock += ((+1)*" + txtQty.Text + @") where  WorkStationID=" + ddlWorkStationSearch.SelectedValue + @" and  ProductID=" + pos_Transaction.Pos_ProductID.ToString() + @";
                            END;
                            */
                                Update Pos_WorkStationStock set Stock += ((-1)*" + txtQty.Text + @") where WorkStationID=" + ddlWorkStationSearch.SelectedValue + @" and  ProductID=" + pos_Transaction.Pos_ProductID.ToString() + @";

                            ";
                }
            }

            if (isAdjustment)
            {
                Pos_TransactionType transactionType = Pos_TransactionTypeManager.GetPos_TransactionTypeByID(transactionTypeID);

                if (transactionType.ShowRoomFormula != "0")
                {
                    sql += @"
                            set @Count=
                            (
                            select COUNT(*) from Pos_WorkStationStock
                            where ProductID=" + pos_Transaction.Pos_ProductID.ToString() + @" and WorkStationID=" + ddlWorkStationSearch.SelectedValue + @"
                            )

                            if @Count = 0
                            BEGIN
                                INSERT INTO [Pos_WorkStationStock]
                                       ([WorkStationID]
                                       ,[ProductID]
                                       ,[Stock])
                                       VALUES(" + ddlWorkStationSearch.SelectedValue + @"," + pos_Transaction.Pos_ProductID.ToString() + @"," + txtQty.Text + @");
                            END
                            ELSE
                            BEGIN
                                Update Pos_WorkStationStock set Stock += ((" + (transactionTypeID==23?"":"-" )+ @"1)*" + txtQty.Text + @") where  WorkStationID=" + ddlWorkStationSearch.SelectedValue + @" and  ProductID=" + pos_Transaction.Pos_ProductID.ToString() + @";
                            END;
                            ";
                }
            }
        }

        CommonManager.SQLExec(sql);
        btnSearch_Click(this, new EventArgs());
        hlnkProductionPrint.Visible = true;
        hlnkProductionPrint.NavigateUrl = "TransactionPrint.aspx?Pos_TransactionMasterID=" + TransactionMasterID.ToString();
        doSearch(true);
    }
Example #21
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        int transactionTypeID = int.Parse(Request.QueryString["TransactionTypeID"]);

        int TransactionMasterID = 0;

        bool   IsIssueReturn = false;
        bool   isTransferToanotherShowroom = false;
        bool   isAdjustment = false;
        string Pending      = "Pending";

        switch (transactionTypeID)
        {
        case 10:     //Issue Return
            IsIssueReturn = true;
            break;

        case 11:     //Transfer to another showroom
            isTransferToanotherShowroom = true;
            break;

        case 23:     //Adjustment +
            isAdjustment = true;
            Pending      = "";
            break;

        case 24:     //Adjustment +
            isAdjustment = true;
            Pending      = "";
            break;

        default:
            break;
        }

        if (txtOldTransactionID.Text != "")
        {
            if (txtOldTransactionID.Text != "0")
            {
                TransactionMasterID = int.Parse(GetTransactionMasterID());
            }
            else
            {
                TransactionMasterID = int.Parse(txtOldTransactionID.Text);
            }

            if (TransactionMasterID == 0)
            {
                showAlartMessage("Wrong old ID");
                return;
            }
        }
        else
        {
            Pos_TransactionMaster pos_TransactionMaster        = new Pos_TransactionMaster();
            Pos_TransactionMaster pos_TransactionMasterOposite = new Pos_TransactionMaster();

            pos_TransactionMaster.TransactionDate       = DateTime.Parse(txtDate.Text);
            pos_TransactionMaster.TransactionID         = 0;
            pos_TransactionMaster.Pos_TransactionTypeID = transactionTypeID;
            pos_TransactionMaster.ToOrFromID            = (isAdjustment?int.Parse(ddlWorkStationSearch.SelectedValue): int.Parse(ddlWorkStation.SelectedValue));
            pos_TransactionMaster.Record         = "";
            pos_TransactionMaster.Particulars    = "";
            pos_TransactionMaster.WorkSatationID = int.Parse(ddlWorkStationSearch.SelectedValue);
            pos_TransactionMaster.ExtraField1    = "";
            pos_TransactionMaster.ExtraField2    = "";
            pos_TransactionMaster.ExtraField3    = "";
            pos_TransactionMaster.ExtraField4    = "";
            pos_TransactionMaster.ExtraField5    = Pending;
            pos_TransactionMaster.AddedBy        = getLogin().LoginID;
            pos_TransactionMaster.AddedDate      = DateTime.Now;
            pos_TransactionMaster.UpdatedBy      = getLogin().LoginID;
            pos_TransactionMaster.UpdatedDate    = DateTime.Now;
            pos_TransactionMaster.RowStatusID    = 1;
            if (isTransferToanotherShowroom)
            {
                TransactionMasterID = Pos_TransactionMasterManager.InsertPos_TransactionMaster(pos_TransactionMaster, true);
            }
            else
            {
                TransactionMasterID = Pos_TransactionMasterManager.InsertPos_TransactionMaster(pos_TransactionMaster);
            }

            pos_TransactionMaster = Pos_TransactionMasterManager.GetPos_TransactionMasterByID(TransactionMasterID);

            txtOldTransactionID.Text = pos_TransactionMaster.TransactionID.ToString();
        }

        string sql = "Declare @Count int; ";

        foreach (GridViewRow gvr in gvPos_Product.Rows)
        {
            HiddenField hfPos_ProductID = (HiddenField)gvr.FindControl("hfPos_ProductID");
            TextBox     txtQty          = (TextBox)gvr.FindControl("txtQty");

            if (txtQty.Text == "")
            {
                continue;
            }
            if (decimal.Parse(txtQty.Text) == 0)
            {
                continue;
            }

            Pos_Transaction pos_Transaction = new Pos_Transaction();

            pos_Transaction.Pos_ProductID = Int32.Parse(hfPos_ProductID.Value);
            pos_Transaction.Quantity      = Decimal.Parse(txtQty.Text);
            pos_Transaction.Pos_ProductTrasactionTypeID    = transactionTypeID;
            pos_Transaction.Pos_ProductTransactionMasterID = TransactionMasterID;
            pos_Transaction.WorkStationID = Int32.Parse(ddlWorkStationSearch.SelectedValue);
            pos_Transaction.ExtraField1   = "";
            pos_Transaction.ExtraField2   = "";
            pos_Transaction.ExtraField3   = "";
            pos_Transaction.ExtraField4   = "";
            pos_Transaction.ExtraField5   = "";
            pos_Transaction.AddedBy       = getLogin().LoginID;
            pos_Transaction.AddedDate     = DateTime.Now;
            pos_Transaction.UpdatedBy     = getLogin().LoginID;
            pos_Transaction.UpdatedDate   = DateTime.Now;
            pos_Transaction.RowStatusID   = 1;

            if (isTransferToanotherShowroom)
            {
                Pos_TransactionManager.InsertPos_TransactionWithOpositeEntry(pos_Transaction);
            }
            else
            {
                Pos_TransactionManager.InsertPos_Transaction(pos_Transaction);
            }



            if (IsIssueReturn)
            {
                Pos_TransactionType transactionType = Pos_TransactionTypeManager.GetPos_TransactionTypeByID(transactionTypeID);

                if (transactionType.CentralStockFormula != "0")
                {
                    //sql += "Update Pos_Product set ExtraField1 =(cast(ExtraField1 as decimal(10,2)) + ((" + transactionType.CentralStockFormula + ")*" + txtQty.Text + ")) where Pos_ProductID=" + pos_Transaction.Pos_ProductID.ToString() + ";";
                }

                if (transactionType.ShowRoomFormula != "0")
                {
                    sql += @"
                            set @Count=
                            (
                            select COUNT(*) from Pos_WorkStationStock
                            where ProductID=" + pos_Transaction.Pos_ProductID.ToString() + @" and WorkStationID=" + ddlWorkStationSearch.SelectedValue + @"
                            )

                            if @Count = 0
                            BEGIN
	                            INSERT INTO [Pos_WorkStationStock]
                                       ([WorkStationID]
                                       ,[ProductID]
                                       ,[Stock])
                                       VALUES(" + ddlWorkStationSearch.SelectedValue + @"," + pos_Transaction.Pos_ProductID.ToString() + @"," + txtQty.Text + @");
                            END
                            ELSE
                            BEGIN
                                Update Pos_WorkStationStock set Stock += ((" + transactionType.ShowRoomFormula + @")*" + txtQty.Text + @") where  WorkStationID=" + ddlWorkStationSearch.SelectedValue + @" and ProductID=" + pos_Transaction.Pos_ProductID.ToString() + @";
                            END;";
                }
            }

            if (isTransferToanotherShowroom)
            {
                Pos_TransactionType transactionType = Pos_TransactionTypeManager.GetPos_TransactionTypeByID(transactionTypeID);

                if (transactionType.ShowRoomFormula != "0")
                {
                    sql += @"/*
                            set @Count=
                            (
                            select COUNT(*) from Pos_WorkStationStock
                            where ProductID=" + pos_Transaction.Pos_ProductID.ToString() + @" and WorkStationID=" + ddlWorkStationSearch.SelectedValue + @"
                            )

                            if @Count = 0
                            BEGIN
	                            INSERT INTO [Pos_WorkStationStock]
                                       ([WorkStationID]
                                       ,[ProductID]
                                       ,[Stock])
                                       VALUES(" + ddlWorkStationSearch.SelectedValue + @"," + pos_Transaction.Pos_ProductID.ToString() + @"," + txtQty.Text + @");
                            END
                            ELSE
                            BEGIN
                                Update Pos_WorkStationStock set Stock += ((+1)*" + txtQty.Text + @") where  WorkStationID=" + ddlWorkStationSearch.SelectedValue + @" and  ProductID=" + pos_Transaction.Pos_ProductID.ToString() + @";
                            END;
                            */
                                Update Pos_WorkStationStock set Stock += ((-1)*" + txtQty.Text + @") where WorkStationID=" + ddlWorkStationSearch.SelectedValue + @" and  ProductID=" + pos_Transaction.Pos_ProductID.ToString() + @";

                            ";
                }
            }

            if (isAdjustment)
            {
                Pos_TransactionType transactionType = Pos_TransactionTypeManager.GetPos_TransactionTypeByID(transactionTypeID);

                if (transactionType.ShowRoomFormula != "0")
                {
                    sql += @"
                            set @Count=
                            (
                            select COUNT(*) from Pos_WorkStationStock
                            where ProductID=" + pos_Transaction.Pos_ProductID.ToString() + @" and WorkStationID=" + ddlWorkStationSearch.SelectedValue + @"
                            )

                            if @Count = 0
                            BEGIN
	                            INSERT INTO [Pos_WorkStationStock]
                                       ([WorkStationID]
                                       ,[ProductID]
                                       ,[Stock])
                                       VALUES(" + ddlWorkStationSearch.SelectedValue + @"," + pos_Transaction.Pos_ProductID.ToString() + @"," + txtQty.Text + @");
                            END
                            ELSE
                            BEGIN
                                Update Pos_WorkStationStock set Stock += ((" + (transactionTypeID == 23?"":"-") + @"1)*" + txtQty.Text + @") where  WorkStationID=" + ddlWorkStationSearch.SelectedValue + @" and  ProductID=" + pos_Transaction.Pos_ProductID.ToString() + @";
                            END;
                            ";
                }
            }
        }

        CommonManager.SQLExec(sql);
        btnSearch_Click(this, new EventArgs());
        hlnkProductionPrint.Visible     = true;
        hlnkProductionPrint.NavigateUrl = "TransactionPrint.aspx?Pos_TransactionMasterID=" + TransactionMasterID.ToString();
        doSearch(true);
    }
Example #22
0
    public static bool UpdatePos_Transaction(Pos_Transaction pos_Transaction)
    {
        SqlPos_TransactionProvider sqlPos_TransactionProvider = new SqlPos_TransactionProvider();

        return(sqlPos_TransactionProvider.UpdatePos_Transaction(pos_Transaction));
    }