private void MatchItem() { Data.SalesTransactionItemDetails _SalesTransactionItemDetails = new Data.SalesTransactionItemDetails(); int oldindex = dgItems.CurrentRowIndex; bool boFound = false; for (int iRow = 0; iRow < ItemDataTable.Rows.Count; iRow++) { dgItems.CurrentRowIndex = iRow; _SalesTransactionItemDetails = getCurrentRowItemDetails(); TransactionItemStatus _TransactionItemStatus = (TransactionItemStatus)Enum.Parse(typeof(TransactionItemStatus), dgItems[iRow, 21].ToString()); if ((_SalesTransactionItemDetails.BarCode == txtScan.Text.Trim() || _SalesTransactionItemDetails.ProductCode.Contains(txtScan.Text.Trim())) && _TransactionItemStatus == TransactionItemStatus.Valid) { _SalesTransactionItemDetails.ScannedQty += 1; ApplyChangeQuantityPriceAmountDetails(iRow, _SalesTransactionItemDetails); //decimal decScannedQty = Convert.ToDecimal(dgItems[iRow, 39].ToString()); //decimal decScannedAmt = Convert.ToDecimal(dgItems[iRow, 40].ToString()); try { dgItems.UnSelect(0); } catch { } dgItems.UnSelect(oldindex); dgItems.Select(dgItems.CurrentRowIndex); boFound = true; break; //if (decScannedQty == 0) { ApplyChangeQuantityPriceAmountDetails(iRow, Details); break; } } } txtScan.Text = string.Empty; if (!boFound) { dgItems.CurrentRowIndex = oldindex; } getTotal(); }
public void ReservedAndCommitItem(Data.SalesTransactionItemDetails Details, TransactionItemStatus _previousTransactionItemStatus) { // Sep 24, 2011 Lemuel E. Aceron // Added order slip wherein all punch items will not change sales and inventory // a customer named ORDER SLIP should be defined in contacts if (mclsSalesTransactionDetails.CustomerName.ToUpper() != Constants.C_RETAILPLUS_ORDER_SLIP_CUSTOMER && mclsSalesTransactionDetails.CustomerDetails.ContactCode != mclsSysConfigDetails.OutOfStockCustomerCode && Details.TransactionItemStatus != TransactionItemStatus.Return) { // Added May 7, 2011 to Cater Reserved and Commit functionality //if (mclsTerminalDetails.ReservedAndCommit) //{ Data.Products clsProduct = new Data.Products(mConnection, mTransaction); mConnection = clsProduct.Connection; mTransaction = clsProduct.Transaction; Data.ProductUnit clsProductUnit = new Data.ProductUnit(mConnection, mTransaction); mConnection = clsProductUnit.Connection; mTransaction = clsProductUnit.Transaction; Data.ProductVariationsMatrix clsProductVariationsMatrix = new Data.ProductVariationsMatrix(mConnection, mTransaction); decimal decNewQuantity = 0; // both refund and normal transaction // Sep 14, 2013: remove the reserved and commit for refund. // refund quantity should only reflect for refund after closing of transaction. // // return is also not applicable for reserved an commit. // return quantity should only reflect for refund after closing of transaction. if (!mboIsRefund) { // SOLD items that are VOID if (Details.TransactionItemStatus == TransactionItemStatus.Void && _previousTransactionItemStatus != TransactionItemStatus.Return) { decNewQuantity = clsProductUnit.GetBaseUnitValue(Details.ProductID, Details.ProductUnitID, Details.Quantity * Details.PackageQuantity); clsProduct.SubtractReservedQuantity(Constants.TerminalBranchID, Details.ProductID, Details.VariationsMatrixID, decNewQuantity, Data.Products.getPRODUCT_INVENTORY_MOVEMENT_VALUE(Data.PRODUCT_INVENTORY_MOVEMENT.DEDUCT_QTY_RESERVE_AND_COMMIT_VOID_ITEM), DateTime.Now, mclsSalesTransactionDetails.TransactionNo, mclsSalesTransactionDetails.CashierName); // Sep 14, 2013: remove // clsProduct.AddQuantity(Constants.TerminalBranchID, Details.ProductID, Details.VariationsMatrixID, decNewQuantity, Data.Products.getPRODUCT_INVENTORY_MOVEMENT_VALUE(Data.PRODUCT_INVENTORY_MOVEMENT.ADD_RESERVE_AND_COMMIT_VOID_ITEM), DateTime.Now, mclsSalesTransactionDetails.TransactionNo, mclsSalesTransactionDetails.CashierName); // remove the ff codes for a change in Jul 26, 2011 // clsProduct.AddQuantity(Details.ProductID, decNewQuantity); // // if (Details.VariationsMatrixID != 0) // clsProductVariationsMatrix.AddQuantity(Details.VariationsMatrixID, decNewQuantity); } // SOLD items else if (Details.TransactionItemStatus != TransactionItemStatus.Void) { decNewQuantity = clsProductUnit.GetBaseUnitValue(Details.ProductID, Details.ProductUnitID, Details.Quantity * Details.PackageQuantity); if (mclsTerminalDetails.IsParkingTerminal) clsProduct.AddReservedQuantity(Constants.TerminalBranchID, Details.ProductID, Details.VariationsMatrixID, decNewQuantity, Data.Products.getPRODUCT_INVENTORY_MOVEMENT_VALUE(Data.PRODUCT_INVENTORY_MOVEMENT.PARKING_IN) + " @ " + (Details.Amount / decNewQuantity).ToString("#,##0.#0") + " Buying: " + Details.PurchasePrice.ToString("#,##0.#0") + " Orig Selling: " + Details.Price.ToString("#,##0.#0") + " Discount: " + (Details.Price - (Details.Amount / decNewQuantity)).ToString("#,##0.#0") + " to " + mclsSalesTransactionDetails.CustomerName, DateTime.Now, mclsSalesTransactionDetails.TransactionNo, mclsSalesTransactionDetails.CashierName); else clsProduct.AddReservedQuantity(Constants.TerminalBranchID, Details.ProductID, Details.VariationsMatrixID, decNewQuantity, Data.Products.getPRODUCT_INVENTORY_MOVEMENT_VALUE(Data.PRODUCT_INVENTORY_MOVEMENT.DEDUCT_SOLD_RETAIL) + " @ " + (Details.Amount / decNewQuantity).ToString("#,##0.#0") + " Buying: " + Details.PurchasePrice.ToString("#,##0.#0") + " Orig Selling: " + Details.Price.ToString("#,##0.#0") + " Discount: " + (Details.Price - (Details.Amount / decNewQuantity)).ToString("#,##0.#0") + " to " + mclsSalesTransactionDetails.CustomerName, DateTime.Now, mclsSalesTransactionDetails.TransactionNo, mclsSalesTransactionDetails.CashierName); // remove the ff codes for a change in Jul 26, 2011 // clsProduct.SubtractQuantity(Details.ProductID, decNewQuantity); // // if (Details.VariationsMatrixID != 0) // clsProductVariationsMatrix.SubtractQuantity(Details.VariationsMatrixID, decNewQuantity); } } //} } }