Example #1
0
    public bool UpdatePos_TransactionMaster(Pos_TransactionMaster pos_TransactionMaster)
    {
        using (SqlConnection connection = new SqlConnection(this.ConnectionString))
        {
            SqlCommand cmd = new SqlCommand("GP_UpdatePos_TransactionMaster", connection);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@Pos_TransactionMasterID", SqlDbType.Int).Value = pos_TransactionMaster.Pos_TransactionMasterID;
            cmd.Parameters.Add("@TransactionDate", SqlDbType.DateTime).Value    = pos_TransactionMaster.TransactionDate;
            cmd.Parameters.Add("@Pos_TransactionTypeID", SqlDbType.Int).Value   = pos_TransactionMaster.Pos_TransactionTypeID;
            cmd.Parameters.Add("@TransactionID", SqlDbType.Int).Value           = pos_TransactionMaster.TransactionID;
            cmd.Parameters.Add("@ToOrFromID", SqlDbType.Int).Value       = pos_TransactionMaster.ToOrFromID;
            cmd.Parameters.Add("@Record", SqlDbType.NVarChar).Value      = pos_TransactionMaster.Record;
            cmd.Parameters.Add("@Particulars", SqlDbType.NText).Value    = pos_TransactionMaster.Particulars;
            cmd.Parameters.Add("@WorkSatationID", SqlDbType.Int).Value   = pos_TransactionMaster.WorkSatationID;
            cmd.Parameters.Add("@ExtraField1", SqlDbType.NVarChar).Value = pos_TransactionMaster.ExtraField1;
            cmd.Parameters.Add("@ExtraField2", SqlDbType.NVarChar).Value = pos_TransactionMaster.ExtraField2;
            cmd.Parameters.Add("@ExtraField3", SqlDbType.NVarChar).Value = pos_TransactionMaster.ExtraField3;
            cmd.Parameters.Add("@ExtraField4", SqlDbType.NVarChar).Value = pos_TransactionMaster.ExtraField4;
            cmd.Parameters.Add("@ExtraField5", SqlDbType.NVarChar).Value = pos_TransactionMaster.ExtraField5;
            cmd.Parameters.Add("@AddedBy", SqlDbType.Int).Value          = pos_TransactionMaster.AddedBy;
            cmd.Parameters.Add("@AddedDate", SqlDbType.DateTime).Value   = pos_TransactionMaster.AddedDate;
            cmd.Parameters.Add("@UpdatedBy", SqlDbType.Int).Value        = pos_TransactionMaster.UpdatedBy;
            cmd.Parameters.Add("@UpdatedDate", SqlDbType.DateTime).Value = pos_TransactionMaster.UpdatedDate;
            cmd.Parameters.Add("@RowStatusID", SqlDbType.Int).Value      = pos_TransactionMaster.RowStatusID;
            connection.Open();

            int result = cmd.ExecuteNonQuery();
            return(result == 1);
        }
    }
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        Pos_TransactionMaster pos_TransactionMaster = new Pos_TransactionMaster();

        pos_TransactionMaster.TransactionDate       = txtTransactionDate.Text;
        pos_TransactionMaster.Pos_TransactionTypeID = Int32.Parse(ddlPos_TransactionType.SelectedValue);
        pos_TransactionMaster.TransactionID         = Int32.Parse(ddlTransaction.SelectedValue);
        pos_TransactionMaster.ToOrFromID            = Int32.Parse(ddlToOrFrom.SelectedValue);
        pos_TransactionMaster.Record         = txtRecord.Text;
        pos_TransactionMaster.Particulars    = txtParticulars.Text;
        pos_TransactionMaster.WorkSatationID = Int32.Parse(ddlWorkSatation.SelectedValue);
        pos_TransactionMaster.ExtraField1    = txtExtraField1.Text;
        pos_TransactionMaster.ExtraField2    = txtExtraField2.Text;
        pos_TransactionMaster.ExtraField3    = txtExtraField3.Text;
        pos_TransactionMaster.ExtraField4    = txtExtraField4.Text;
        pos_TransactionMaster.ExtraField5    = txtExtraField5.Text;
        pos_TransactionMaster.AddedBy        = Int32.Parse(txtAddedBy.Text);
        pos_TransactionMaster.AddedDate      = DateTime.Now;
        pos_TransactionMaster.UpdatedBy      = Int32.Parse(txtUpdatedBy.Text);
        pos_TransactionMaster.UpdatedDate    = txtUpdatedDate.Text;
        pos_TransactionMaster.RowStatusID    = Int32.Parse(ddlRowStatus.SelectedValue);
        int resutl = Pos_TransactionMasterManager.InsertPos_TransactionMaster(pos_TransactionMaster);

        Response.Redirect("AdminPos_TransactionMasterDisplay.aspx");
    }
    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        Pos_TransactionMaster pos_TransactionMaster = new Pos_TransactionMaster();

        pos_TransactionMaster = Pos_TransactionMasterManager.GetPos_TransactionMasterByID(Int32.Parse(Request.QueryString["pos_TransactionMasterID"]));
        Pos_TransactionMaster tempPos_TransactionMaster = new Pos_TransactionMaster();

        tempPos_TransactionMaster.Pos_TransactionMasterID = pos_TransactionMaster.Pos_TransactionMasterID;

        tempPos_TransactionMaster.TransactionDate       = txtTransactionDate.Text;
        tempPos_TransactionMaster.Pos_TransactionTypeID = Int32.Parse(ddlPos_TransactionType.SelectedValue);
        tempPos_TransactionMaster.TransactionID         = Int32.Parse(ddlTransaction.SelectedValue);
        tempPos_TransactionMaster.ToOrFromID            = Int32.Parse(ddlToOrFrom.SelectedValue);
        tempPos_TransactionMaster.Record         = txtRecord.Text;
        tempPos_TransactionMaster.Particulars    = txtParticulars.Text;
        tempPos_TransactionMaster.WorkSatationID = Int32.Parse(ddlWorkSatation.SelectedValue);
        tempPos_TransactionMaster.ExtraField1    = txtExtraField1.Text;
        tempPos_TransactionMaster.ExtraField2    = txtExtraField2.Text;
        tempPos_TransactionMaster.ExtraField3    = txtExtraField3.Text;
        tempPos_TransactionMaster.ExtraField4    = txtExtraField4.Text;
        tempPos_TransactionMaster.ExtraField5    = txtExtraField5.Text;
        tempPos_TransactionMaster.AddedBy        = Int32.Parse(txtAddedBy.Text);
        tempPos_TransactionMaster.AddedDate      = DateTime.Now;
        tempPos_TransactionMaster.UpdatedBy      = Int32.Parse(txtUpdatedBy.Text);
        tempPos_TransactionMaster.UpdatedDate    = txtUpdatedDate.Text;
        tempPos_TransactionMaster.RowStatusID    = Int32.Parse(ddlRowStatus.SelectedValue);
        bool result = Pos_TransactionMasterManager.UpdatePos_TransactionMaster(tempPos_TransactionMaster);

        Response.Redirect("AdminPos_TransactionMasterDisplay.aspx");
    }
 public static Pos_TransactionMaster GetPos_TransactionMasterByID(int id)
 {
     Pos_TransactionMaster pos_TransactionMaster = new Pos_TransactionMaster();
     SqlPos_TransactionMasterProvider sqlPos_TransactionMasterProvider = new SqlPos_TransactionMasterProvider();
     pos_TransactionMaster = sqlPos_TransactionMasterProvider.GetPos_TransactionMasterByID(id);
     return pos_TransactionMaster;
 }
Example #5
0
    public static Pos_TransactionMaster GetPos_TransactionMasterByID(int id)
    {
        Pos_TransactionMaster            pos_TransactionMaster            = new Pos_TransactionMaster();
        SqlPos_TransactionMasterProvider sqlPos_TransactionMasterProvider = new SqlPos_TransactionMasterProvider();

        pos_TransactionMaster = sqlPos_TransactionMasterProvider.GetPos_TransactionMasterByID(id);
        return(pos_TransactionMaster);
    }
Example #6
0
    protected void btnReceived_Click(object sender, EventArgs e)
    {
        int Pos_TransactionMasterID = int.Parse(Request.QueryString["Pos_TransactionMasterID"]);

        Pos_TransactionMaster pos_TransactionMaster = Pos_TransactionMasterManager.GetPos_TransactionMasterByID(Pos_TransactionMasterID);

        Pos_TransactionType transactionType = Pos_TransactionTypeManager.GetPos_TransactionTypeByID(pos_TransactionMaster.Pos_TransactionTypeID);
        string sql = "Declare @Count int; ";

        sql += "update Pos_TransactionMaster set  ExtraField5='' where Pos_TransactionMasterID=" + Pos_TransactionMasterID + ";";


        List <Pos_Product> items = new List <Pos_Product>();

        items = Pos_ProductManager.GetAllPos_ProductsByTrasactionMasterID(Pos_TransactionMasterID);
        foreach (Pos_Product pos_Transaction in items)
        {
            if (pos_TransactionMaster.WorkSatationID == 1 && transactionType.CentralStockFormula != "0")
            {
                //For head office Central Stock
                sql += "Update Pos_Product set ExtraField1 =(cast(ExtraField1 as decimal(10,2)) + ((" + transactionType.CentralStockFormula + ")*" + pos_Transaction.ExtraField1 + ")) where Pos_ProductID=" + pos_Transaction.Pos_ProductID.ToString() + ";";
            }
            else
            if (pos_TransactionMaster.WorkSatationID != 1 && transactionType.ShowRoomFormula != "0")
            {
                sql += @"
                            set @Count=
                            (
                            select COUNT(*) from Pos_WorkStationStock
                            where ProductID=" + pos_Transaction.Pos_ProductID.ToString() + @" and WorkStationID=" + pos_TransactionMaster.WorkSatationID + @"
                            )

                            if @Count = 0
                            BEGIN
	                            INSERT INTO [Pos_WorkStationStock]
                                        ([WorkStationID]
                                        ,[ProductID]
                                        ,[Stock])
                                        VALUES(" + pos_TransactionMaster.WorkSatationID + @"," + pos_Transaction.Pos_ProductID.ToString() + @"," + pos_Transaction.ExtraField1 + @");
                            END
                            ELSE
                            BEGIN
                                Update Pos_WorkStationStock set Stock += ((+1)*" + pos_Transaction.ExtraField1 + @") where  WorkStationID=" + pos_TransactionMaster.WorkSatationID + @" and  ProductID=" + pos_Transaction.Pos_ProductID.ToString() + @";
                            END;
                            
                                ";
            }
            CommonManager.SQLExec(sql);
        }

        Response.Redirect("TransactionPrint.aspx?Pos_TransactionMasterID=" + Pos_TransactionMasterID);
    }
Example #7
0
    public Pos_TransactionMaster GetPos_TransactionMasterFromReader(IDataReader reader)
    {
        try
        {
            Pos_TransactionMaster pos_TransactionMaster = new Pos_TransactionMaster
                                                          (
                (int)reader["Pos_TransactionMasterID"],
                (DateTime)reader["TransactionDate"],
                (int)reader["Pos_TransactionTypeID"],
                (int)reader["TransactionID"],
                (int)reader["ToOrFromID"],
                reader["Record"].ToString(),
                reader["Particulars"].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"]
                                                          );

            try {
                pos_TransactionMaster.ToOrFromName = reader["ToOrFromName"].ToString();
            }
            catch (Exception ex)
            {
                pos_TransactionMaster.ToOrFromName = "N/A";
            }

            return(pos_TransactionMaster);
        }
        catch (Exception ex)
        {
            return(null);
        }
    }
    private void showPos_TransactionMasterData()
    {
        Pos_TransactionMaster pos_TransactionMaster = new Pos_TransactionMaster();

        pos_TransactionMaster = Pos_TransactionMasterManager.GetPos_TransactionMasterByID(Int32.Parse(Request.QueryString["pos_TransactionMasterID"]));

        txtTransactionDate.Text = pos_TransactionMaster.TransactionDate;
        ddlPos_TransactionType.SelectedValue = pos_TransactionMaster.Pos_TransactionTypeID.ToString();
        ddlTransaction.SelectedValue         = pos_TransactionMaster.TransactionID.ToString();
        ddlToOrFrom.SelectedValue            = pos_TransactionMaster.ToOrFromID.ToString();
        txtRecord.Text                = pos_TransactionMaster.Record;
        txtParticulars.Text           = pos_TransactionMaster.Particulars;
        ddlWorkSatation.SelectedValue = pos_TransactionMaster.WorkSatationID.ToString();
        txtExtraField1.Text           = pos_TransactionMaster.ExtraField1;
        txtExtraField2.Text           = pos_TransactionMaster.ExtraField2;
        txtExtraField3.Text           = pos_TransactionMaster.ExtraField3;
        txtExtraField4.Text           = pos_TransactionMaster.ExtraField4;
        txtExtraField5.Text           = pos_TransactionMaster.ExtraField5;
        txtAddedBy.Text               = pos_TransactionMaster.AddedBy.ToString();
        txtUpdatedBy.Text             = pos_TransactionMaster.UpdatedBy.ToString();
        txtUpdatedDate.Text           = pos_TransactionMaster.UpdatedDate;
        ddlRowStatus.SelectedValue    = pos_TransactionMaster.RowStatusID.ToString();
    }
    public Pos_TransactionMaster GetPos_TransactionMasterFromReader(IDataReader reader)
    {
        try
        {
            Pos_TransactionMaster pos_TransactionMaster = new Pos_TransactionMaster
                (
                    (int)reader["Pos_TransactionMasterID"],
                    (DateTime)reader["TransactionDate"],
                    (int)reader["Pos_TransactionTypeID"],
                    (int)reader["TransactionID"],
                    (int)reader["ToOrFromID"],
                    reader["Record"].ToString(),
                    reader["Particulars"].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"]
                );

            try {
                pos_TransactionMaster.ToOrFromName = reader["ToOrFromName"].ToString();
            }
            catch (Exception ex)
            {
                pos_TransactionMaster.ToOrFromName = "N/A";
            }

             return pos_TransactionMaster;
        }
        catch(Exception ex)
        {
            return null;
        }
    }
    public bool UpdatePos_TransactionMaster(Pos_TransactionMaster pos_TransactionMaster)
    {
        using (SqlConnection connection = new SqlConnection(this.ConnectionString))
        {
            SqlCommand cmd = new SqlCommand("GP_UpdatePos_TransactionMaster", connection);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@Pos_TransactionMasterID", SqlDbType.Int).Value = pos_TransactionMaster.Pos_TransactionMasterID;
            cmd.Parameters.Add("@TransactionDate", SqlDbType.DateTime).Value = pos_TransactionMaster.TransactionDate;
            cmd.Parameters.Add("@Pos_TransactionTypeID", SqlDbType.Int).Value = pos_TransactionMaster.Pos_TransactionTypeID;
            cmd.Parameters.Add("@TransactionID", SqlDbType.Int).Value = pos_TransactionMaster.TransactionID;
            cmd.Parameters.Add("@ToOrFromID", SqlDbType.Int).Value = pos_TransactionMaster.ToOrFromID;
            cmd.Parameters.Add("@Record", SqlDbType.NVarChar).Value = pos_TransactionMaster.Record;
            cmd.Parameters.Add("@Particulars", SqlDbType.NText).Value = pos_TransactionMaster.Particulars;
            cmd.Parameters.Add("@WorkSatationID", SqlDbType.Int).Value = pos_TransactionMaster.WorkSatationID;
            cmd.Parameters.Add("@ExtraField1", SqlDbType.NVarChar).Value = pos_TransactionMaster.ExtraField1;
            cmd.Parameters.Add("@ExtraField2", SqlDbType.NVarChar).Value = pos_TransactionMaster.ExtraField2;
            cmd.Parameters.Add("@ExtraField3", SqlDbType.NVarChar).Value = pos_TransactionMaster.ExtraField3;
            cmd.Parameters.Add("@ExtraField4", SqlDbType.NVarChar).Value = pos_TransactionMaster.ExtraField4;
            cmd.Parameters.Add("@ExtraField5", SqlDbType.NVarChar).Value = pos_TransactionMaster.ExtraField5;
            cmd.Parameters.Add("@AddedBy", SqlDbType.Int).Value = pos_TransactionMaster.AddedBy;
            cmd.Parameters.Add("@AddedDate", SqlDbType.DateTime).Value = pos_TransactionMaster.AddedDate;
            cmd.Parameters.Add("@UpdatedBy", SqlDbType.Int).Value = pos_TransactionMaster.UpdatedBy;
            cmd.Parameters.Add("@UpdatedDate", SqlDbType.DateTime).Value = pos_TransactionMaster.UpdatedDate;
            cmd.Parameters.Add("@RowStatusID", SqlDbType.Int).Value = pos_TransactionMaster.RowStatusID;
            connection.Open();

            int result = cmd.ExecuteNonQuery();
            return result == 1;
        }
    }
Example #11
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 #12
0
    private void loadData()
    {
        int Pos_TransactionMasterID = int.Parse(Request.QueryString["Pos_TransactionMasterID"]);

        Pos_TransactionMaster pos_TransactionMaster = Pos_TransactionMasterManager.GetPos_TransactionMasterByID(Pos_TransactionMasterID);

        lblPurchaseDate.Text  = pos_TransactionMaster.TransactionDate.ToString("dd-MMM-yyyy");
        lblParticulars.Text   = pos_TransactionMaster.Particulars;
        lblTransactionID.Text = pos_TransactionMaster.TransactionID.ToString() + (pos_TransactionMaster.RowStatusID == 1? (Request.QueryString["Delete"] != null ? " (<a href='TransactionDelete.aspx?Pos_TransactionMasterID=" + Request.QueryString["Pos_TransactionMasterID"] + "'>X</a>)" : ""):"<b style='color:red;'>(Deleted)</b>");
        lblRefferenceIDs.Text = pos_TransactionMaster.Record;
        lblToOrFromName.Text  = pos_TransactionMaster.ToOrFromName;

        if ((pos_TransactionMaster.ToOrFromID.ToString() != getLogin().ExtraField5
             &&
             pos_TransactionMaster.WorkSatationID.ToString() != getLogin().ExtraField5
             ) && getLogin().ExtraField5 != "1")
        {
            showAlartMessage("Your are not allowed to View this Transaction");
            btnReceived.Visible = false;
            return;
        }
        if (pos_TransactionMaster.ExtraField5 == "Pending")
        {
            lblExtraField5.Text = pos_TransactionMaster.ExtraField5;
            if (pos_TransactionMaster.Pos_TransactionTypeID == 12
                &&
                getLogin().ExtraField5 == pos_TransactionMaster.WorkSatationID.ToString()
                )
            {
                lblExtraField5.Visible = true;
                btnReceived.Visible    = true;
            }
            else
            if (getLogin().ExtraField5 == pos_TransactionMaster.ToOrFromID.ToString())
            {
                lblExtraField5.Visible = true;
                btnReceived.Visible    = true;
            }
            else
            {
                lblExtraField5.Visible = false;
                btnReceived.Visible    = false;
            }
        }
        else
        {
            lblExtraField5.Visible = false;
            btnReceived.Visible    = false;
        }


        string NoOfcollum = "9";

        trRefference.Visible = false;
        trToOrFrom.Visible   = false;

        lblVoucherType.Text = Pos_TransactionTypeManager.GetPos_TransactionTypeByID(pos_TransactionMaster.Pos_TransactionTypeID).TransactionTypeName;

        switch (pos_TransactionMaster.Pos_TransactionTypeID)
        {
        case 1:
            break;

        case 2:
            break;

        case 3:
            break;

        case 4:
            break;

        case 5:
            break;

        case 6:
            break;

        case 7:
            break;

        case 8:
            break;

        case 9:
            trToOrFrom.Visible = true;
            break;

        case 10:
            trToOrFrom.Visible = true;
            break;

        case 11:     //Branch Transfer
            trToOrFrom.Visible = true;
            break;

        case 12:     //Branch Transfer
            trToOrFrom.Visible = true;
            break;

        case 25:
            trToOrFrom.Visible = true;
            NoOfcollum         = "10";
            break;

        default:
            break;
        }

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

        items = Pos_ProductManager.GetAllPos_ProductsByTrasactionMasterID(Pos_TransactionMasterID);

        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>Status</td>
                            <td>Quantity</td>
                            <td>Unit</td>
                            " + (NoOfcollum == "10" ? "<td>Cost</td><td>Total Cost</td>" : "")
                           + @"<td>Sale Price</td>
                            <td>VAT %</td>
                            <td>Amount</td>
                        </tr>";
        int     lastRawMaterialID  = 0;
        decimal Total              = 0;
        decimal Subtotal           = 0;
        decimal TotalAmount        = 0;
        decimal SubtotalAmount     = 0;
        decimal TotalAmountCost    = 0;
        decimal SubtotalAmountCost = 0;
        int     serialNo           = 1;

        foreach (Pos_Product item in items)
        {
            if (item.RowStatusID != 1)
            {
                continue;
            }
            if (lastRawMaterialID != 0 && lastRawMaterialID != item.ProductID)
            {
                htmlTable += @"<tr class='subtotalRow'>
                            <td>&nbsp;</td>
                            <td>&nbsp;</td>
                            <td>&nbsp;</td>
                            <td>Sub Total</td>
                            <td>" + Subtotal.ToString("0,0.000000") + @"</td>
                            <td>&nbsp;</td>
                            " + (NoOfcollum == "10" ? "<td>&nbsp;</td><td>" + SubtotalAmountCost.ToString("0,0.000000") + @"</td>" : "")
                             + @"<td>&nbsp;</td>
                            <td>&nbsp;</td>
                            <td>" + SubtotalAmount.ToString("0,0.000000") + @"</td>
                        </tr>";

                Subtotal           = 0;
                SubtotalAmount     = 0;
                SubtotalAmountCost = 0;
            }

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

            htmlTable += @"<tr class='itemCss'>
                            <td  style='border-left:0px;'>" + (serialNo++).ToString() + (item.RowStatusID == 1 ? (Request.QueryString["Delete"] != null ? (pos_TransactionMaster.Pos_TransactionTypeID == 13?"": " (<a href='TransactionDelete.aspx?Pos_TransactionID=" + item.ExtraField10 + "&Pos_TransactionMasterID=" + Request.QueryString["Pos_TransactionMasterID"] + "'>X</a>)") : "") : "<b style='color:red;'>(Deleted)</b>") + @"</td>
                            <td>" + item.BarCode + @"</td>
                            <td>" + item.ExtraField2 + @"</td>
                            <td>" + item.ExtraField8 + @"</td>
                            <td style='text-align:right;'>" + decimal.Parse(item.ExtraField1).ToString("0,0.000000") + @"</td>
                            <td >" + item.ExtraField3 + @"</td>
                            " + (NoOfcollum == "10" ? "<td style='text-align:right;'>" + decimal.Parse(item.ExtraField4).ToString("0,0.000000") + @"</td><td>" + (decimal.Parse(item.ExtraField1) * decimal.Parse(item.ExtraField4)).ToString("0,0.000000") + @"</td>" : "")
                         + @"<td style='text-align:right;'>" + item.SalePrice.ToString("0,0.000000") + @"</td>
                            <td style='text-align:right;'>" + item.VatPercentage.ToString("0,0.000000") + @"</td>
                            <td style='text-align:right;'>" + ((decimal.Parse(item.ExtraField1) * item.SalePrice) + ((decimal.Parse(item.ExtraField1) * item.SalePrice) * item.VatPercentage / 100)).ToString("0,0.000000") + @"</td>
                        </tr>";

            Subtotal           += decimal.Parse(item.ExtraField1);
            SubtotalAmount     += ((decimal.Parse(item.ExtraField1) * item.SalePrice) + ((decimal.Parse(item.ExtraField1) * item.SalePrice) * item.VatPercentage / 100));
            SubtotalAmountCost += decimal.Parse(item.ExtraField1) * decimal.Parse(item.ExtraField4);

            Total           += decimal.Parse(item.ExtraField1);
            TotalAmount     += ((decimal.Parse(item.ExtraField1) * item.SalePrice) + ((decimal.Parse(item.ExtraField1) * item.SalePrice) * item.VatPercentage / 100));
            TotalAmountCost += decimal.Parse(item.ExtraField1) * decimal.Parse(item.ExtraField4);
        }

        htmlTable += @"<tr class='subtotalRow'>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td>Sub Total</td>
                        <td>" + Subtotal.ToString("0,0.000000") + @"</td>
                        <td>&nbsp;</td>
                        " + (NoOfcollum == "10" ? "<td>&nbsp;</td><td>" + SubtotalAmountCost.ToString("0,0.000000") + @"</td>" : "")
                     + @"<td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td>" + SubtotalAmount.ToString("0,0.000000") + @"</td>
                    </tr>";

        htmlTable += @"<tr id='lastRow'>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td>Grand Total</td>
                        <td>" + Total.ToString("0,0.000000") + @"</td>
                        <td>&nbsp;</td>
                        " + (NoOfcollum == "10" ? "<td>&nbsp;</td><td>" + TotalAmountCost.ToString("0,0.000000") + @"</td>" : "")
                     + @"<td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td>" + TotalAmount.ToString("0,0.000000") + @"</td>
                    </tr></table>";

        lblItemList.Text = htmlTable;
    }
Example #13
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 #14
0
    private void loadData()
    {
        lblStockDate.Text = DateTime.Today.ToString("dd/MM/yyyy");
        int Pos_TransactionMasterID = int.Parse(Request.QueryString["Pos_TransactionMasterID"]);

        Pos_TransactionMaster pos_TransactionMaster = Pos_TransactionMasterManager.GetPos_TransactionMasterByID(Pos_TransactionMasterID);

        lblPurchaseDate.Text  = pos_TransactionMaster.TransactionDate.ToString("dd-MMM-yyyy");
        lblParticulars.Text   = pos_TransactionMaster.Particulars;
        lblTransactionID.Text = pos_TransactionMaster.TransactionID.ToString();
        lblRefferenceIDs.Text = pos_TransactionMaster.Record;
        lblToOrFromName.Text  = pos_TransactionMaster.ToOrFromName;
        if (pos_TransactionMaster.ToOrFromID.ToString() != getLogin().ExtraField5&& getLogin().ExtraField5 != "1")
        {
            showAlartMessage("Your are not allowed to View this Chalan");
            btnReceived.Visible = false;
            return;
        }
        if (pos_TransactionMaster.ExtraField5 == "Pending")
        {
            lblExtraField5.Text = pos_TransactionMaster.ExtraField5;
            if (getLogin().ExtraField5 == pos_TransactionMaster.ToOrFromID.ToString())
            {
                lblExtraField5.Visible = true;
                btnReceived.Visible    = true;
            }
            else
            {
                lblExtraField5.Visible = false;
                btnReceived.Visible    = false;
            }
        }
        else
        {
            lblExtraField5.Visible = false;
            btnReceived.Visible    = false;
        }
        //purchase info
        string sql = @"SELECT 
Pos_Product.StyleCode as Style,Pos_Product.BarCode
,Pos_Size.SizeName as Size,Pos_Color.ColorName as Color
,Pos_Product.ProductName as Product
,Pos_Transaction.Quantity as [Stock]
,Pos_Product.SalePrice 
      ,(Pos_Transaction.Quantity * Pos_Product.SalePrice) as Amount
  FROM Pos_Product
  inner join Pos_Size on Pos_Product.Pos_SizeID=Pos_Size.Pos_SizeID
  inner join Pos_Color on Pos_Product.Pos_ColorID=Pos_Color.Pos_ColorID
inner join Pos_Transaction on Pos_Transaction.Pos_ProductID =Pos_Product.Pos_ProductID
inner join Pos_TransactionMaster on Pos_TransactionMaster.Pos_TransactionMasterID = Pos_Transaction.Pos_ProductTransactionMasterID
 where   Pos_TransactionMaster.Pos_TransactionMasterID =" + Pos_TransactionMasterID.ToString() + @"
order by Pos_Product.StyleCode,Pos_Product.BarCode
";

        DataSet ds = CommonManager.SQLExec(sql);

        int serialNo = 1;

        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>Bar Code</td>
                            <td>Description</td>
                            <td>Color</td>
                            <td>Size</td>
                            <td>Quantity</td>
                            <td>Unit Price</td>
                            <td>Amount</td>
                        </tr>
                            ";

        decimal subtotalQty         = 0;
        decimal subtotalUnitPrice   = 0;
        decimal subtotalStockAmount = 0;

        decimal totalQty         = 0;
        decimal totalUnitPrice   = 0;
        decimal totalStockAmount = 0;

        decimal GrandtotalQty         = 0;
        decimal GrandtotalUnitPrice   = 0;
        decimal GrandtotalStockAmount = 0;

        string lastProductName = "";
        string lastStyle       = "";

        foreach (DataRow dr in ds.Tables[0].Rows)
        {
            if (decimal.Parse(dr["Stock"].ToString()) > 0)
            {
                if (lastProductName == "")
                {
                    htmlTable      += @" <tr id='tableHeader'>
                            <td  style='border-left:0px;'></td>
                            <td colspan='7' style='text-align:left;'>Item Name :" + dr["Product"].ToString() + @"</td>
                        </tr>
                            ";
                    lastProductName = dr["Product"].ToString();

                    htmlTable += @" <tr id='tableHeader'>
                            <td  style='border-left:0px;'></td>
                            <td colspan='7' style='text-align:left;'>Style :" + dr["Style"].ToString() + @"</td>
                        </tr>
                            ";
                    lastStyle  = dr["Style"].ToString();
                }
                else
                if (lastProductName != dr["Product"].ToString())
                {
                    htmlTable += @" <tr class='subtotalRow'>
                            <td  style='border-left:0px;'></td>
                            <td style='text-align:right;' colspan='4'>Total</td>
                            <td>" + totalQty.ToString("0,0") + @"</td>
                            <td>" + totalUnitPrice.ToString("0,0.00") + @"</td>
                            <td>" + totalStockAmount.ToString("0,0.00") + @"</td>
                        </tr>
                             <tr class='subtotalRow'>
                            <td  style='border-left:0px;'></td>
                            <td style='text-align:right;' colspan='4'>Sub Total</td>
                            <td>" + subtotalQty.ToString("0,0") + @"</td>
                            <td>" + subtotalUnitPrice.ToString("0,0.00") + @"</td>
                            <td>" + subtotalStockAmount.ToString("0,0.00") + @"</td>
                        </tr>
                            ";

                    htmlTable += @" <tr  id='tableHeader'>
                            <td  style='border-left:0px;'></td>
                            <td colspan='7' style='text-align:left;'>Item Name :" + dr["Product"].ToString() + @"</td>
                        </tr>
                            ";
                    htmlTable += @" <tr  id='tableHeader'>
                            <td  style='border-left:0px;'></td>
                            <td colspan='7' style='text-align:left;'>Style :" + dr["Style"].ToString() + @"</td>
                        </tr>
                            ";

                    lastProductName = dr["Product"].ToString();
                    lastStyle       = dr["Style"].ToString();

                    subtotalQty         = 0;
                    subtotalUnitPrice   = 0;
                    subtotalStockAmount = 0;

                    totalQty         = 0;
                    totalUnitPrice   = 0;
                    totalStockAmount = 0;
                }
                else
                if (lastStyle != dr["Style"].ToString())
                {
                    htmlTable += @" <tr class='subtotalRow'>
                            <td  style='border-left:0px;'></td>
                            <td style='text-align:right;' colspan='4'>Total</td>
                            <td>" + totalQty.ToString("0,0") + @"</td>
                            <td>" + totalUnitPrice.ToString("0,0.00") + @"</td>
                            <td>" + totalStockAmount.ToString("0,0.00") + @"</td>
                        </tr>
                            ";

                    htmlTable += @" <tr id='tableHeader'>
                            <td  style='border-left:0px;'></td>
                            <td colspan='7' style='text-align:left;'>Style :" + dr["Style"].ToString() + @"</td>
                        </tr>
                            ";

                    lastStyle = dr["Style"].ToString();

                    totalQty         = 0;
                    totalUnitPrice   = 0;
                    totalStockAmount = 0;
                }

                totalUnitPrice   += decimal.Parse(dr["SalePrice"].ToString());
                totalQty         += decimal.Parse(dr["Stock"].ToString());
                totalStockAmount += decimal.Parse(dr["Amount"].ToString());

                subtotalUnitPrice   += decimal.Parse(dr["SalePrice"].ToString());
                subtotalQty         += decimal.Parse(dr["Stock"].ToString());
                subtotalStockAmount += decimal.Parse(dr["Amount"].ToString());

                GrandtotalUnitPrice   += decimal.Parse(dr["SalePrice"].ToString());
                GrandtotalQty         += decimal.Parse(dr["Stock"].ToString());
                GrandtotalStockAmount += decimal.Parse(dr["Amount"].ToString());



                htmlTable += @" <tr class='itemCss'>
                            <td  style='border-left:0px;'>" + (serialNo++).ToString() + @"</td>
                            <td>" + dr["BarCode"].ToString() + @"</td>
                            <td>" + dr["Product"].ToString() + @"</td>
                            <td>" + dr["Color"].ToString() + @"</td>
                            <td>" + dr["Size"].ToString() + @"</td>
                            <td style='text-align:right;'>" + decimal.Parse(dr["Stock"].ToString()).ToString("0,0") + @"</td>
                            <td style='text-align:right;'>" + decimal.Parse(dr["SalePrice"].ToString()).ToString("0,0.00") + @"</td>
                            <td style='text-align:right;'>" + decimal.Parse(dr["Amount"].ToString()).ToString("0,0.00") + @"</td>
                        </tr>
                            ";
            }
        }
        htmlTable += @" <tr id='lastRow'>
                            <td  style='border-left:0px;'></td>
                            <td style='text-align:right;' colspan='4'>Total</td>
                            <td>" + totalQty.ToString("0,0") + @"</td>
                            <td>" + totalUnitPrice.ToString("0,0.00") + @"</td>
                            <td>" + totalStockAmount.ToString("0,0.00") + @"</td>
                        </tr>
                             <tr id='lastRow'>
                            <td  style='border-left:0px;'></td>
                            <td style='text-align:right;' colspan='4'>Sub Total</td>
                            <td>" + subtotalQty.ToString("0,0") + @"</td>
                            <td>" + subtotalUnitPrice.ToString("0,0.00") + @"</td>
                            <td>" + subtotalStockAmount.ToString("0,0.00") + @"</td>
                        </tr>
                            <tr id='lastRow'>
                            <td  style='border-left:0px;'></td>
                            <td style='text-align:right;' colspan='4'>Grand Total</td>
                            <td>" + GrandtotalQty.ToString("0,0") + @"</td>
                            <td>" + GrandtotalUnitPrice.ToString("0,0.00") + @"</td>
                            <td>" + GrandtotalStockAmount.ToString("0,0.00") + @"</td>
                        </tr>
                           </table>  ";

        lblItemList.Text = htmlTable;
    }
Example #15
0
    public static bool UpdatePos_TransactionMaster(Pos_TransactionMaster pos_TransactionMaster)
    {
        SqlPos_TransactionMasterProvider sqlPos_TransactionMasterProvider = new SqlPos_TransactionMasterProvider();

        return(sqlPos_TransactionMasterProvider.UpdatePos_TransactionMaster(pos_TransactionMaster));
    }
Example #16
0
    public static int InsertPos_TransactionMaster(Pos_TransactionMaster pos_TransactionMaster)
    {
        SqlPos_TransactionMasterProvider sqlPos_TransactionMasterProvider = new SqlPos_TransactionMasterProvider();

        return(sqlPos_TransactionMasterProvider.InsertPos_TransactionMaster(pos_TransactionMaster));
    }
Example #17
0
    private void DeleteSingleTransactionMaster()
    {
        int Pos_TransactionMasterID = int.Parse(Request.QueryString["Pos_TransactionMasterID"]);

        Pos_TransactionMaster pos_TransactionMaster = Pos_TransactionMasterManager.GetPos_TransactionMasterByID(Pos_TransactionMasterID);
        //Item Info
        List <Pos_Product> items = new List <Pos_Product>();

        items = Pos_ProductManager.GetAllPos_ProductsByTrasactionMasterID(Pos_TransactionMasterID);

        string sql = "";

        sql  = "Update Pos_TransactionMaster set  UpdatedDate=GetDate(),UpdatedBy=" + getLogin().LoginID.ToString() + @" where Pos_TransactionMasterID=" + Request.QueryString["Pos_TransactionMasterID"] + ";";
        sql += "Update Pos_Transaction set  UpdatedDate=GetDate(),UpdatedBy=" + getLogin().LoginID.ToString() + @",RowStatusID=3 where Pos_ProductTransactionMasterID=" + Request.QueryString["Pos_TransactionMasterID"] + " and  Pos_TransactionID=" + Request.QueryString["Pos_TransactionID"] + ";";
        bool executionProgramed = false;

        switch (pos_TransactionMaster.Pos_TransactionTypeID)
        {
        case 1:
            break;

        case 2:
            break;

        case 3:
            break;

        case 4:
            break;

        case 5:
            break;

        case 6:
            break;

        case 7:
            break;

        case 8:
            break;

        case 9:     //issue to show room
            executionProgramed = true;
            if (pos_TransactionMaster.ExtraField5 != "Pending")
            {
                foreach (Pos_Product item in items)
                {
                    sql += "Update Pos_WorkStationStock set   Stock -= " + item.ExtraField1 + @" where ProductID=" + item.Pos_ProductID.ToString() + @" and WorkStationID=" + pos_TransactionMaster.WorkSatationID.ToString() + ";";
                    sql += "Update Pos_Product set ExtraField1 =(cast(ExtraField1 as decimal(10,2)) + ((" + "+1" + ")*" + item.ExtraField1 + ")) where Pos_ProductID=" + item.Pos_ProductID.ToString() + ";";

                    sql += "Update ACC_JournalMaster set RowStatusID=3 where ExtraField2='POS ISSUE' and ExtraField3='" + Request.QueryString["Pos_TransactionMasterID"] + @"';";
                    sql += "Update ACC_JournalDetail set RowStatusID=3 where JournalMasterID=(select ACC_JournalMasterID from ACC_JournalMaster where ExtraField2='POS ISSUE' and ExtraField3='" + Request.QueryString["Pos_TransactionMasterID"] + @"');";
                }
            }
            else
            {
                foreach (Pos_Product item in items)
                {
                    sql += "Update Pos_Product set ExtraField1 =(cast(ExtraField1 as decimal(10,2)) + ((" + "+1" + ")*" + item.ExtraField1 + ")) where Pos_ProductID=" + item.Pos_ProductID.ToString() + ";";
                }
            }

            break;

        case 10:    //issue return to show room
            executionProgramed = true;
            if (pos_TransactionMaster.ExtraField5 != "Pending")
            {
                foreach (Pos_Product item in items)
                {
                    sql += "Update Pos_WorkStationStock set   Stock += " + item.ExtraField1 + @" where ProductID=" + item.Pos_ProductID.ToString() + @" and WorkStationID=" + pos_TransactionMaster.WorkSatationID.ToString() + ";";
                    sql += "Update Pos_Product set ExtraField1 =(cast(ExtraField1 as decimal(10,2)) + ((" + "-1" + ")*" + item.ExtraField1 + ")) where Pos_ProductID=" + item.Pos_ProductID.ToString() + ";";
                }
            }
            else
            {
                foreach (Pos_Product item in items)
                {
                    sql += "Update Pos_WorkStationStock set   Stock += " + item.ExtraField1 + @" where ProductID=" + item.Pos_ProductID.ToString() + @" and WorkStationID=" + pos_TransactionMaster.WorkSatationID.ToString() + ";";
                }
            }
            break;

        case 11:     //Send to another Branch
        {
            executionProgramed = true;
            //Sender Delete
            foreach (Pos_Product item in items)
            {
                sql += "Update Pos_WorkStationStock set   Stock += " + item.ExtraField1 + @" where ProductID=" + item.Pos_ProductID.ToString() + @" and WorkStationID=" + pos_TransactionMaster.WorkSatationID.ToString() + ";";
            }

            //Receiver Delete
            Pos_TransactionMasterID++;
            pos_TransactionMaster = Pos_TransactionMasterManager.GetPos_TransactionMasterByID(Pos_TransactionMasterID);
            sql  = "Update Pos_TransactionMaster set  UpdatedDate=GetDate(),UpdatedBy=" + getLogin().LoginID.ToString() + @",RowStatusID=3 where Pos_TransactionMasterID=" + Pos_TransactionMasterID.ToString() + ";";
            sql += "Update Pos_Transaction set  UpdatedDate=GetDate(),UpdatedBy=" + getLogin().LoginID.ToString() + @",RowStatusID=3 where Pos_ProductTransactionMasterID=" + Pos_TransactionMasterID.ToString() + ";";

            //Item Info
            if (pos_TransactionMaster.ExtraField5 != "Pending")
            {
                items = new List <Pos_Product>();
                items = Pos_ProductManager.GetAllPos_ProductsByTrasactionMasterID(Pos_TransactionMasterID);

                foreach (Pos_Product item in items)
                {
                    sql += "Update Pos_WorkStationStock set   Stock -= " + item.ExtraField1 + @" where ProductID=" + item.Pos_ProductID.ToString() + @" and WorkStationID=" + pos_TransactionMaster.WorkSatationID.ToString() + ";";
                }
            }
            break;
        }

        case 12:     //Received from another branch
            showAlartMessage("Please ask the sender branch to delete.");
            break;

        case 13:     //Sales
        {
            executionProgramed = true;

            if (pos_TransactionMaster.UpdatedBy < 0)        //when sales return
            {
                //cencel the sales return
                sql += "Update Pos_TransactionMaster set  UpdatedDate=GetDate(),UpdatedBy=" + getLogin().LoginID.ToString() + @",RowStatusID=3 where Pos_TransactionMasterID=" + (-1 * pos_TransactionMaster.UpdatedBy) + ";";
                sql += "Update Pos_Transaction set  UpdatedDate=GetDate(),UpdatedBy=" + getLogin().LoginID.ToString() + @",RowStatusID=3 where Pos_ProductTransactionMasterID=" + (-1 * pos_TransactionMaster.UpdatedBy) + ";";

                string  returnSales      = "select * from Pos_Transaction where Pos_ProductTransactionMasterID=" + (-1 * pos_TransactionMaster.UpdatedBy) + ";";
                DataSet dsReturnSales    = CommonManager.SQLExec(returnSales);
                bool    masterNotUpdated = true;
                foreach (DataRow dr in dsReturnSales.Tables[0].Rows)
                {
                    if (masterNotUpdated)
                    {
                        //update the sales of which the sales was returned
                        sql += "Update Pos_TransactionMaster set UpdatedDate=GetDate(), Particulars= cast(Particulars as nvarchar(max))+'<hr/>Sales Return Cancelled' where Pos_TransactionMasterID=(Select Pos_ProductTransactionMasterID from Pos_Transaction where  Pos_TransactionID=" + dr["ExtraField4"] + ");";

                        masterNotUpdated = false;
                    }

                    //revercing the sales return
                    sql += "Update Pos_Transaction set  UpdatedDate=GetDate(),UpdatedBy=" + getLogin().LoginID.ToString() + @",ExtraField4= (cast(ExtraField4 as int)-" + decimal.Parse(dr["Quantity"].ToString()).ToString("0") + ") where Pos_TransactionID=" + dr["ExtraField4"] + ";";
                    sql += "update Pos_WorkStationStock set Stock-=" + decimal.Parse(dr["Quantity"].ToString()).ToString("0") + " where WorkStationID=" + pos_TransactionMaster.WorkSatationID.ToString() + " and ProductID=" + dr["Pos_ProductID"] + ";";
                }
            }

            foreach (Pos_Product item in items)
            {
                sql += "Update Pos_WorkStationStock set   Stock += " + item.ExtraField1 + @" where ProductID=" + item.Pos_ProductID.ToString() + @" and WorkStationID=" + pos_TransactionMaster.WorkSatationID.ToString() + ";";
            }

            sql += "Update ACC_JournalMaster set RowStatusID=3 where ExtraField2='POS SALE' and ExtraField3='" + Request.QueryString["Pos_TransactionMasterID"] + @"';";
            sql += "Update ACC_JournalDetail set RowStatusID=3 where JournalMasterID=(select ACC_JournalMasterID from ACC_JournalMaster where ExtraField2='POS SALE' and ExtraField3='" + Request.QueryString["Pos_TransactionMasterID"] + @"');";
        }
        break;

        case 25:    //Purchase
        {
            executionProgramed = true;
            string sql_tmp = @"Select * from Pos_Transaction where Pos_TransactionID=" + Request.QueryString["Pos_TransactionID"]
                             + "; Select * from ACC_JournalMaster where Note='" + "Product Purchase-'+(Select cast(TransactionID as nvarchar) from Pos_TransactionMaster where Pos_TransactionMasterID=" + Request.QueryString["Pos_TransactionMasterID"] + ")";

            DataSet ds = CommonManager.SQLExec(sql_tmp);
            if (pos_TransactionMaster.ExtraField5 != "Pending")
            {
                foreach (Pos_Product item in items)
                {
                    if (ds.Tables[0].Rows[0]["Pos_ProductID"].ToString() == item.Pos_ProductID.ToString())
                    {
                        sql += "; update Pos_Product set pos_Product.RowStatusID = 3 where Pos_ProductID=" + item.Pos_ProductID;
                        sql += "; Update [Pos_Transaction] set [RowStatusID]=3 where Pos_TransactionID=" + Request.QueryString["Pos_TransactionID"];
                        sql += "; Update [ACC_JournalDetail] set [RowStatusID]=3 where [JournalMasterID]=" + ds.Tables[1].Rows[0]["ACC_JournalMasterID"].ToString() + " and ExtraField1='" + item.Pos_ProductID.ToString() + "'";
                        break;
                    }
                }
            }
            else
            {
                foreach (Pos_Product item in items)
                {
                    if (ds.Tables[0].Rows[0]["Pos_ProductID"].ToString() == item.Pos_ProductID.ToString())
                    {
                        sql += "; update Pos_Product set pos_Product.RowStatusID = 3 where Pos_ProductID=" + item.Pos_ProductID;
                        sql += "; Update [Pos_Transaction] set [RowStatusID]=3 where Pos_TransactionID=" + Request.QueryString["Pos_TransactionID"];
                        sql += "; Update [ACC_JournalDetail] set [RowStatusID]=3 where [JournalMasterID]=" + ds.Tables[1].Rows[0]["ACC_JournalMasterID"].ToString() + " and ExtraField1='" + item.Pos_ProductID.ToString() + "'";
                        break;
                    }
                }
            }
        }
        break;

        default:
            break;
        }

        if (executionProgramed)
        {
            try
            {
                CommonManager.SQLExec(sql);
                showAlartMessage("Delete Successfully");
            }
            catch (Exception ex)
            {
                showAlartMessage("Delete Error");
            }
        }
    }
Example #18
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 #19
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 #20
0
    public static int InsertPos_TransactionMaster(Pos_TransactionMaster pos_TransactionMaster, bool isdoubleEntry)
    {
        SqlPos_TransactionMasterProvider sqlPos_TransactionMasterProvider = new SqlPos_TransactionMasterProvider();

        return(sqlPos_TransactionMasterProvider.InsertPos_TransactionMaster(pos_TransactionMaster, isdoubleEntry));
    }
 public static int InsertPos_TransactionMaster(Pos_TransactionMaster pos_TransactionMaster)
 {
     SqlPos_TransactionMasterProvider sqlPos_TransactionMasterProvider = new SqlPos_TransactionMasterProvider();
     return sqlPos_TransactionMasterProvider.InsertPos_TransactionMaster(pos_TransactionMaster);
 }
Example #22
0
    protected void btnReceived_Click(object sender, EventArgs e)
    {
        int Pos_TransactionMasterID = int.Parse(Request.QueryString["Pos_TransactionMasterID"]);

        Pos_TransactionMaster pos_TransactionMaster = Pos_TransactionMasterManager.GetPos_TransactionMasterByID(Pos_TransactionMasterID);

        Pos_TransactionType transactionType = Pos_TransactionTypeManager.GetPos_TransactionTypeByID(pos_TransactionMaster.Pos_TransactionTypeID);
        string sql = "Declare @Count int; ";

        sql += "update Pos_TransactionMaster set  ExtraField5='' where Pos_TransactionMasterID=" + Pos_TransactionMasterID + ";";


        List <Pos_Product> items = new List <Pos_Product>();

        items = Pos_ProductManager.GetAllPos_ProductsByTrasactionMasterID(Pos_TransactionMasterID);
        //updated by is the transaction ID
        string accountingEntry = "";

        accountingEntry += @"
                                Declare @JournalMasterID int
                                Declare @ProductID int
                                Declare @FinishedGoodsAmount decimal(18,2)
                                INSERT INTO [ACC_JournalMaster]
                                           ([JournalMasterName]
                                           ,[ExtraField1]
                                           ,[ExtraField2]
                                           ,[ExtraField3]
                                           ,[Note]
                                           ,[JournalDate]
                                           ,[AddedBy]
                                           ,[AddedDate]
                                           ,[UpdatedBy]
                                           ,[UpdatedDate]
                                           ,[RowStatusID])
                                     VALUES
                                           ('1'--<JournalMasterName, nvarchar(50),>
                                           ,''--<ExtraField1, nvarchar(256),>
                                           ,'POS ISSUE'--<ExtraField2, nvarchar(256),>
                                           ,'" + Pos_TransactionMasterID.ToString() + @"'--<ExtraField3, nvarchar(256),>
                                           ,'" + pos_TransactionMaster.ToOrFromName + " " + "Chalan #: " + pos_TransactionMaster.TransactionID + @"'--<Note, nvarchar(256),>
                                           ,GETDATE()--<JournalDate, datetime,>
                                           ," + pos_TransactionMaster.AddedBy.ToString() + @"--<AddedBy, int,>
                                           ,GETDATE()--<AddedDate, datetime,>
                                           ," + pos_TransactionMaster.AddedBy.ToString() + @"--<UpdatedBy, int,>
                                           ,GETDATE()--<UpdatedDate, datetime,>
                                           ,1--<RowStatusID, int,>
                                           );
                                Set @JournalMasterID = SCOPE_IDENTITY();
                                ";
        foreach (Pos_Product pos_Transaction in items)
        {
            //Finished Good(Aseet) -- branch
            accountingEntry += @"
                            Set @ProductID=(Select ProductID from Pos_Product where Pos_ProductID=" + pos_Transaction.Pos_ProductID.ToString() + @")
                            set @FinishedGoodsAmount=(select ([Pos_Product].[FabricsCost] + [Pos_Product].[AccesoriesCost] + [Pos_Product].[Overhead]+[Pos_Product].[OthersCost]+[Pos_Product].[PurchasePrice]) from Pos_Product where Pos_ProductID=" + pos_Transaction.Pos_ProductID.ToString() + @")
                            INSERT INTO [ACC_JournalDetail]
                                   ([JournalMasterID]
                                   ,[ACC_ChartOfAccountLabel4ID]
                                   ,[ACC_ChartOfAccountLabel3ID]
                                   ,[WorkStation]
                                   ,[Debit]
                                   ,[Credit]
                                   ,[ExtraField3]
                                   ,[ExtraField2]
                                   ,[ExtraField1]
                                   ,[AddedBy]
                                   ,[AddedDate]
                                   ,[UpdatedBy]
                                   ,[UpdatedDate]
                                   ,[RowStatusID])
                             VALUES
                                   (@JournalMasterID--<JournalMasterID, int,>
                                   ,@ProductID--<ACC_ChartOfAccountLabel4ID, int,>
                                   ,9--<ACC_ChartOfAccountLabel3ID, int,>
                                   ," + pos_TransactionMaster.ToOrFromID + @"--<WorkStation, int,>
                                   ,(@FinishedGoodsAmount *" + decimal.Parse(pos_Transaction.ExtraField1).ToString("0.00") + @")--<Debit, decimal(20,2),>
                                   ,0--<Credit, decimal(20,2),>
                                   ,'" + pos_Transaction.UpdatedBy + @"'--<ExtraField3, nvarchar(256),>
                                   ,'POS ISSUE'--<ExtraField2, nvarchar(256),>
                                   ,''--<ExtraField1, nvarchar(256),>
                                   ," + pos_TransactionMaster.AddedBy.ToString() + @"--<AddedBy, int,>
                                    ,GETDATE()--<AddedDate, datetime,>
                                    ," + pos_TransactionMaster.AddedBy.ToString() + @"--<UpdatedBy, int,>
                                    ,GETDATE()--<UpdatedDate, datetime,>
                                    ,1--<RowStatusID, int,>
                                   )  ;
                            ";

            //Finished Good(Aseet) -- head office
            accountingEntry += @"
                            Set @ProductID=(Select ProductID from Pos_Product where Pos_ProductID=" + pos_Transaction.Pos_ProductID.ToString() + @")
                            set @FinishedGoodsAmount=(select ([Pos_Product].[FabricsCost] + [Pos_Product].[AccesoriesCost] + [Pos_Product].[Overhead]+[Pos_Product].[OthersCost]+[Pos_Product].[PurchasePrice]) from Pos_Product where Pos_ProductID=" + pos_Transaction.Pos_ProductID.ToString() + @")
                            INSERT INTO [ACC_JournalDetail]
                                   ([JournalMasterID]
                                   ,[ACC_ChartOfAccountLabel4ID]
                                   ,[ACC_ChartOfAccountLabel3ID]
                                   ,[WorkStation]
                                   ,[Debit]
                                   ,[Credit]
                                   ,[ExtraField3]
                                   ,[ExtraField2]
                                   ,[ExtraField1]
                                   ,[AddedBy]
                                   ,[AddedDate]
                                   ,[UpdatedBy]
                                   ,[UpdatedDate]
                                   ,[RowStatusID])
                             VALUES
                                   (@JournalMasterID--<JournalMasterID, int,>
                                   ,@ProductID--<ACC_ChartOfAccountLabel4ID, int,>
                                   ,9--<ACC_ChartOfAccountLabel3ID, int,>
                                   ,1--<WorkStation, int,>
                                   ,0--<Debit, decimal(20,2),>
                                   ,(@FinishedGoodsAmount *" + decimal.Parse(pos_Transaction.ExtraField1).ToString("0.00") + @")--<Credit, decimal(20,2),>
                                   ,'" + pos_Transaction.UpdatedBy + @"'--<ExtraField3, nvarchar(256),>
                                   ,'POS ISSUE'--<ExtraField2, nvarchar(256),>
                                   ,''--<ExtraField1, nvarchar(256),>
                                   ," + pos_TransactionMaster.AddedBy.ToString() + @"--<AddedBy, int,>
                                    ,GETDATE()--<AddedDate, datetime,>
                                    ," + pos_TransactionMaster.AddedBy.ToString() + @"--<UpdatedBy, int,>
                                    ,GETDATE()--<UpdatedDate, datetime,>
                                    ,1--<RowStatusID, int,>
                                   )  ;
                            ";

            if (pos_TransactionMaster.ToOrFromID == 1 && transactionType.CentralStockFormula != "0")
            {
                //For head office Central Stock
                sql += "Update Pos_Product set ExtraField1 =(cast(ExtraField1 as decimal(10,2)) + ((" + transactionType.CentralStockFormula + ")*" + pos_Transaction.ExtraField1 + ")) where Pos_ProductID=" + pos_Transaction.Pos_ProductID.ToString() + ";";
            }
            else
            if (pos_TransactionMaster.ToOrFromID != 1 && transactionType.ShowRoomFormula != "0")
            {
                sql += @"
                            set @Count=
                            (
                            select COUNT(*) from Pos_WorkStationStock
                            where ProductID=" + pos_Transaction.Pos_ProductID.ToString() + @" and WorkStationID=" + pos_TransactionMaster.ToOrFromID + @"
                            )

                            if @Count = 0
                            BEGIN
	                            INSERT INTO [Pos_WorkStationStock]
                                        ([WorkStationID]
                                        ,[ProductID]
                                        ,[Stock])
                                        VALUES(" + pos_TransactionMaster.ToOrFromID + @"," + pos_Transaction.Pos_ProductID.ToString() + @"," + pos_Transaction.ExtraField1 + @");
                            END
                            ELSE
                            BEGIN
                                Update Pos_WorkStationStock set Stock += ((+1)*" + pos_Transaction.ExtraField1 + @") where  WorkStationID=" + pos_TransactionMaster.ToOrFromID + @" and  ProductID=" + pos_Transaction.Pos_ProductID.ToString() + @";
                            END;
                            
                                ";
            }
        }

        //CommonManager.SQLExec(sql);
        CommonManager.SQLExec(sql + accountingEntry);

        Response.Redirect("DelivaryChalanPrint.aspx?Pos_TransactionMasterID=" + Pos_TransactionMasterID);
    }
 public static int InsertPos_TransactionMaster(Pos_TransactionMaster pos_TransactionMaster,bool isdoubleEntry)
 {
     SqlPos_TransactionMasterProvider sqlPos_TransactionMasterProvider = new SqlPos_TransactionMasterProvider();
     return sqlPos_TransactionMasterProvider.InsertPos_TransactionMaster(pos_TransactionMaster, isdoubleEntry);
 }
Example #24
0
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        if (barCodeChecking())
        {
            return;
        }

        int TransactionMasterID = 0;
        int JournalMasterID = 0;
        if (txtOldTrasactionID.Text != "")
        {
            if (hfTransactionMasterID.Value == "0")
            {

                TransactionMasterID = int.Parse(GetTransactionMasterID().Split('@')[0]);
                JournalMasterID = int.Parse(GetTransactionMasterID().Split('@')[1]);
            }
            else
            {
                TransactionMasterID = int.Parse(hfTransactionMasterID.Value);
                JournalMasterID = int.Parse(hfJournalMasterID.Value);
            }

            if (TransactionMasterID == 0)
            {
                showAlartMessage("Wrong old ID");
                return;
            }
        }
        else
        {
            //Regenerate ta kon transaction master er under e probe?

            Pos_TransactionMaster pos_TransactionMaster = new Pos_TransactionMaster();

            pos_TransactionMaster.TransactionDate = DateTime.Parse(txtProductionDate.Text);
            pos_TransactionMaster.TransactionID = 0;
            pos_TransactionMaster.Pos_TransactionTypeID = (Request.QueryString["IsPurchased"] == null ? 1 : 25);
            pos_TransactionMaster.ToOrFromID = (Request.QueryString["IsPurchased"] != null ? int.Parse(ddlSuppier.SelectedValue) : int.Parse(ddlProductionUnit.SelectedValue));
            pos_TransactionMaster.Record = "";
            pos_TransactionMaster.Particulars = txtNote.Text;
            pos_TransactionMaster.WorkSatationID = (Request.QueryString["IsPurchased"] != null ? 1 : int.Parse(ddlProductionUnit.SelectedValue)); ;
            pos_TransactionMaster.ExtraField1 = "";
            pos_TransactionMaster.ExtraField2 = "";
            pos_TransactionMaster.ExtraField3 = "";
            pos_TransactionMaster.ExtraField4 = "";
            pos_TransactionMaster.ExtraField5 = "";
            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);

            txtOldTrasactionID.Text = pos_TransactionMaster.TransactionID.ToString();
            hfTransactionMasterID.Value = TransactionMasterID.ToString();

            if (Request.QueryString["IsPurchased"] != null)
            {
                //Journal Entry
                ACC_JournalMaster aCC_JournalMaster = new ACC_JournalMaster();

                aCC_JournalMaster.JournalMasterName = "3";//Journal Voucher
                aCC_JournalMaster.ExtraField1 = ddlSuppier.SelectedItem.Text;
                aCC_JournalMaster.ExtraField2 = "";
                aCC_JournalMaster.ExtraField3 = "";
                aCC_JournalMaster.Note = "Product Purchase-" + pos_TransactionMaster.TransactionID.ToString();
                aCC_JournalMaster.JournalDate = pos_TransactionMaster.TransactionDate;
                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);
                hfJournalMasterID.Value = JournalMasterID.ToString();
            }
        }
        Pos_Product pos_Product = new Pos_Product();
        pos_Product.ProductID = Int32.Parse(ddlProduct.SelectedValue);
        pos_Product.ReferenceID = TransactionMasterID;
        pos_Product.Pos_ProductTypeID = 1;
        pos_Product.ProductStatusID = Int32.Parse(ddlProductStatus.SelectedValue);
        pos_Product.ProductName = ddlProduct.SelectedItem.Text;
        pos_Product.Pos_BrandID = Int32.Parse(ddlPos_Brand.SelectedValue);
        pos_Product.Inv_QuantityUnitID = Int32.Parse(ddlInv_QuantityUnit.SelectedValue);

        pos_Product.Note = txtNote.Text;

        pos_Product.Pic1 = txtPicture.Value;
        pos_Product.Pic2 = "";
        pos_Product.Pic3 = "";
        pos_Product.VatPercentage = Decimal.Parse(txtVatPercentage.Text);
        pos_Product.IsVatExclusive = cbIsVatExclusive.Checked;
        pos_Product.DiscountPercentage = Decimal.Parse(txtDiscountPercentage.Text);
        pos_Product.FabricsNo = ddlProductionUnit.SelectedValue;
        pos_Product.ExtraField1 = "";
        pos_Product.ExtraField2 = "";
        pos_Product.ExtraField3 = "";
        pos_Product.ExtraField4 = "";
        pos_Product.ExtraField5 = "";
        pos_Product.ExtraField6 = "";
        pos_Product.ExtraField7 = "";
        pos_Product.ExtraField8 = "";
        pos_Product.ExtraField9 = ddlSuppier.SelectedValue;
        pos_Product.ExtraField10 = JournalMasterID.ToString();
        pos_Product.AddedBy = getLogin().LoginID;
        pos_Product.AddedDate = DateTime.Now;
        pos_Product.UpdatedBy = getLogin().LoginID;
        pos_Product.UpdatedDate = DateTime.Now;
        pos_Product.RowStatusID = 1;
        string ids = "";
        foreach (GridViewRow gvr in gvProductConfiguration.Rows)
        {
            /*
            <asp:HiddenField ID="hfColorID" runat="server" Value='<%#Eval("Pos_ColorID") %>'/>
                                <asp:HiddenField ID="hfPos_SizeID" runat="server" Value='<%#Eval("Pos_SizeID") %>'/>
                                <asp:HiddenField ID="hfFabricsCost" runat="server" Value='<%#Eval("FabricsCost") %>'/>
                                <asp:HiddenField ID="hfAccesoriesCost" runat="server" Value='<%#Eval("AccesoriesCost") %>'/>
                                <asp:HiddenField ID="hfOverhead" runat="server" Value='<%#Eval("Overhead") %>'/>
                                <asp:HiddenField ID="hfOthersCost" runat="server" Value='<%#Eval("OthersCost") %>'/>
                                <asp:HiddenField ID="hfUtilizationIDs" runat="server" Value='<%#Eval("Inv_UtilizationDetailsIDs") %>'/>
            */
            HiddenField hfColorID = (HiddenField)gvr.FindControl("hfColorID");
            HiddenField hfPos_SizeID = (HiddenField)gvr.FindControl("hfPos_SizeID");
            HiddenField hfFabricsCost = (HiddenField)gvr.FindControl("hfFabricsCost");
            HiddenField hfAccesoriesCost = (HiddenField)gvr.FindControl("hfAccesoriesCost");
            HiddenField hfOverhead = (HiddenField)gvr.FindControl("hfOverhead");
            HiddenField hfOthersCost = (HiddenField)gvr.FindControl("hfOthersCost");
            HiddenField hfUtilizationIDs = (HiddenField)gvr.FindControl("hfUtilizationIDs");
            HiddenField hfProductCode = (HiddenField)gvr.FindControl("hfProductCode");
            HiddenField hfDesignCode = (HiddenField)gvr.FindControl("hfDesignCode");
            HiddenField hfSizeCode = (HiddenField)gvr.FindControl("hfSizeCode");

            DropDownList ddlColor_Config = (DropDownList)gvr.FindControl("ddlColor_Config");
            DropDownList ddlPos_FabricsType = (DropDownList)gvr.FindControl("ddlPos_FabricsType");

            TextBox txtSalesPrice_Config = (TextBox)gvr.FindControl("txtSalesPrice_Config");
            TextBox txtCurrentProcessing = (TextBox)gvr.FindControl("txtCurrentProcessing");
            TextBox lblAgvCosting = (TextBox)gvr.FindControl("lblAgvCosting");

            TextBox lblBarCode = (TextBox)gvr.FindControl("lblBarCode");

            pos_Product.Inv_UtilizationDetailsIDs = hfUtilizationIDs.Value;
            pos_Product.Pos_SizeID = Int32.Parse(hfPos_SizeID.Value);

            pos_Product.FabricsCost = Decimal.Parse(hfFabricsCost.Value);
            pos_Product.AccesoriesCost = Decimal.Parse(hfAccesoriesCost.Value);
            pos_Product.Overhead = Decimal.Parse(hfOverhead.Value);
            pos_Product.OthersCost = Decimal.Parse(hfOthersCost.Value);
            pos_Product.PurchasePrice = (Request.QueryString["IsPurchased"] == null?0:Decimal.Parse(lblAgvCosting.Text));
            pos_Product.SalePrice = Decimal.Parse(txtSalesPrice_Config.Text);
            pos_Product.OldSalePrice =0;

            pos_Product.DiscountAmount =((pos_Product.SalePrice * Decimal.Parse(txtDiscountPercentage.Text))/100);

            pos_Product.Pos_ColorID = Int32.Parse(ddlColor_Config.SelectedValue);
            pos_Product.Pos_FabricsTypeID = Int32.Parse(ddlPos_FabricsType.SelectedValue);
            pos_Product.ExtraField1 = txtCurrentProcessing.Text;
            pos_Product.DesignCode = hfDesignCode.Value;
            pos_Product.BarCode = lblBarCode.Text;

            pos_Product.StyleCode = txtStyle.Text;//getStyleCode(pos_Product);
            int productID = Pos_ProductManager.InsertPos_Product(pos_Product);

            ids += (ids != "" ? "," : "") + productID.ToString();
        }

        SaveForRemoteDB(ids);

        processUtilizationDetails(TransactionMasterID);

        hlnkProductionPrint.Visible = true;
        hlnkProductionPrint.NavigateUrl = "TransactionPrint.aspx?Pos_TransactionMasterID="+TransactionMasterID.ToString();
        btnClear_Click(this, new EventArgs());
    }
 public static bool UpdatePos_TransactionMaster(Pos_TransactionMaster pos_TransactionMaster)
 {
     SqlPos_TransactionMasterProvider sqlPos_TransactionMasterProvider = new SqlPos_TransactionMasterProvider();
     return sqlPos_TransactionMasterProvider.UpdatePos_TransactionMaster(pos_TransactionMaster);
 }