Exemplo n.º 1
0
        private void SelectItem()
        {
            if (grdView.RowCount > 0)
            {
                selectedDataRow = grdView.GetDataRow(grdView.GetSelectedRows()[0]);
                if (selectedDataRow != null)
                {
                    InputConfirmation inputconfirm = new InputConfirmation();
                    inputconfirm.PromptText = "SKU Release Reason ";
                    inputconfirm.InputType  = InputType.Normal;
                    if (!string.IsNullOrEmpty(Convert.ToString(selectedDataRow["REASON"])))
                    {
                        inputconfirm.Text = Convert.ToString(selectedDataRow["REASON"]);
                    }

                    Interaction.frmInput Oinput = new Interaction.frmInput(inputconfirm);
                    Oinput.ShowDialog();
                    if (!string.IsNullOrEmpty(Oinput.InputText))
                    {
                        selectedDataRow["REASON"]      = Oinput.InputText;
                        selectedDataRow["RELEASEDATE"] = DateTime.Now.Date.ToString("dd/MM/yyyy");
                        ReleaseSKU(Convert.ToDateTime(selectedDataRow["RELEASEDATE"]), Convert.ToString(selectedDataRow["REASON"]), Convert.ToString(selectedDataRow["TRANSACTIONID"]), Convert.ToString(selectedDataRow["SKU"]), 1);
                    }
                    else
                    {
                        selectedDataRow["REASON"]      = Oinput.InputText;
                        selectedDataRow["RELEASEDATE"] = "01/01/1900";
                        ReleaseSKU(null, string.Empty, Convert.ToString(selectedDataRow["TRANSACTIONID"]), Convert.ToString(selectedDataRow["SKU"]), 0);
                    }
                }
            }
            else
            {
                txtKeyboardInput.Select();
            }
        }
        public void PrePayment(IPreTriggerResult preTriggerResult, IPosTransaction posTransaction, object posOperation, string tenderId)
        {
            RetailTransaction retailTransaction = posTransaction as RetailTransaction;

            LSRetailPosis.Transaction.CustomerPaymentTransaction custTrans = posTransaction as LSRetailPosis.Transaction.CustomerPaymentTransaction;
            if (custTrans != null)
            {
                InputConfirmation inputconfirm = new InputConfirmation();
                inputconfirm.PromptText = "Remarks ";
                inputconfirm.InputType  = InputType.Normal;

                Interaction.frmInput Oinput = new Interaction.frmInput(inputconfirm);
                Oinput.ShowDialog();
                if (!string.IsNullOrEmpty(Oinput.InputText))
                {
                    custTrans.PartnerData.Remarks = Oinput.InputText;
                }
                else
                {
                    custTrans.PartnerData.Remarks = "";
                }

                if ((PosisOperations)posOperation == PosisOperations.PayCreditMemo)
                {
                    preTriggerResult.ContinueOperation = false;
                    return;
                }

                SqlConnection connection = new SqlConnection();

                if (application != null)
                {
                    connection = application.Settings.Database.Connection;
                }
                else
                {
                    connection = ApplicationSettings.Database.LocalConnection;
                }

                Enums.EnumClass oEnum       = new Enums.EnumClass();
                string          sMaxAmount  = string.Empty;
                string          sTerminalID = ApplicationSettings.Terminal.TerminalId;
                string          sMinAmt     = Convert.ToString(oEnum.ValidateMinDeposit(connection, out sMaxAmount, sTerminalID, Convert.ToDecimal((((LSRetailPosis.Transaction.CustomerPaymentTransaction)(posTransaction))).CustomerDepositItem.Amount)));
                if (Convert.ToDecimal(sMinAmt) != 0 && Convert.ToDecimal(sMaxAmount) != 0)
                {
                    if (Convert.ToDecimal(sMinAmt) > Convert.ToDecimal((((LSRetailPosis.Transaction.CustomerPaymentTransaction)(posTransaction))).CustomerDepositItem.Amount) ||
                        Convert.ToDecimal(sMaxAmount) < Convert.ToDecimal((((LSRetailPosis.Transaction.CustomerPaymentTransaction)(posTransaction))).CustomerDepositItem.Amount))
                    {
                        preTriggerResult.ContinueOperation = false;
                        preTriggerResult.MessageId         = 50448;
                        return;
                    }
                }
            }

            //start : RH on 05/11/2014
            if (retailTransaction != null)
            {
                /* InputConfirmation inC = new InputConfirmation();
                 * inC.PromptText = "Remarks";
                 * inC.InputType = InputType.Normal;
                 *
                 * Interaction.frmInput Oinput = new Interaction.frmInput(inC);
                 * Oinput.ShowDialog();
                 * if(!string.IsNullOrEmpty(Oinput.InputText))
                 *   retailTransaction.PartnerData.Remarks = Oinput.InputText;
                 * else
                 *   retailTransaction.PartnerData.Remarks = "";*/

                int iPM    = 100;
                int iCF    = 100;
                int isSale = 0;
                foreach (SaleLineItem saleLineItem in retailTransaction.SaleItems)
                {
                    if (!saleLineItem.Voided)
                    {
                        isSale = 1;
                        iPM    = getMetalType(saleLineItem.ItemId);
                        if (iPM == (int)MetalType.PackingMaterial)
                        {
                            break;
                        }
                    }
                }
                if (isSale == 1 && string.IsNullOrEmpty(retailTransaction.PartnerData.Remarks))
                {
                    InputConfirmation inC = new InputConfirmation();
                    inC.PromptText = "Remarks";
                    inC.InputType  = InputType.Normal;

                    Interaction.frmInput Oinput = new Interaction.frmInput(inC);
                    Oinput.ShowDialog();
                    if (!string.IsNullOrEmpty(Oinput.InputText))
                    {
                        retailTransaction.PartnerData.Remarks = Oinput.InputText;
                    }
                    else
                    {
                        retailTransaction.PartnerData.Remarks = "";
                    }
                }



                if ((isSale == 1 || retailTransaction.SaleIsReturnSale) && string.IsNullOrEmpty(retailTransaction.PartnerData.TouristNumber))
                {
                    using (LSRetailPosis.POSProcesses.frmMessage dialog = new LSRetailPosis.POSProcesses.frmMessage("Tourist VAT Applicable.", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
                    {
                        LSRetailPosis.POSProcesses.POSFormsManager.ShowPOSForm(dialog);
                        //command.Parameters.Add("@GOLDFIXING", SqlDbType.Bit).Value = Convert.ToString(dialog.DialogResult).ToUpper().Trim() == "YES" ? "True" : "False";
                        if (Convert.ToString(dialog.DialogResult).ToUpper().Trim() == "YES")
                        {
                            InputConfirmation inC = new InputConfirmation();
                            inC.PromptText = "Tourist VAT Applicable";
                            inC.InputType  = InputType.Normal;
                            inC.MaxLength  = 20;

                            Interaction.frmInput Oinput = new Interaction.frmInput(inC);
                            Oinput.ShowDialog();
                            if (!string.IsNullOrEmpty(Oinput.InputText))
                            {
                                retailTransaction.PartnerData.TouristNumber = Oinput.InputText;
                            }
                            else
                            {
                                retailTransaction.PartnerData.TouristNumber = "";
                            }
                        }
                    }
                }



                string sAdjustmentId = AdjustmentItemID();
                foreach (SaleLineItem SLineItem in retailTransaction.SaleItems)
                {
                    //if(SLineItem.ItemId == sAdjustmentId && retailTransaction.SaleItems.Count == 1)
                    //{
                    //    retailTransaction.RefundReceiptId = "1";
                    //    //break;
                    //}

                    if (SLineItem.ItemId == sAdjustmentId && retailTransaction.SaleItems.Count > 0)
                    {
                        retailTransaction.RefundReceiptId = "1";
                    }
                    if (SLineItem.ItemId != sAdjustmentId)
                    {
                        retailTransaction.RefundReceiptId = "";
                        break;
                    }
                }


                foreach (SaleLineItem saleLineItem in retailTransaction.SaleItems)
                {
                    if (!saleLineItem.Voided)
                    {
                        iCF = getMetalType(saleLineItem.ItemId);
                        if (iCF == (int)MetalType.Certificate)
                        {
                            break;
                        }
                    }
                }

                foreach (SaleLineItem saleLineItem in retailTransaction.SaleItems)
                {
                    if (saleLineItem.ReturnLineId == 0)
                    {
                        if (retailTransaction.PartnerData.PackingMaterial != "Y")
                        {
                            if (IsRetailItem(saleLineItem.ItemId))
                            {
                                if (iPM != (int)MetalType.PackingMaterial)
                                {
                                    #region Commented
                                    //using(LSRetailPosis.POSProcesses.frmMessage dialog = new LSRetailPosis.POSProcesses.frmMessage("Have you issued packing material?", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
                                    //{
                                    //    LSRetailPosis.POSProcesses.POSFormsManager.ShowPOSForm(dialog);
                                    //    if(Convert.ToString(dialog.DialogResult).ToUpper().Trim() == "NO")
                                    //    {
                                    //        preTriggerResult.ContinueOperation = false;
                                    //        return;
                                    //    }
                                    //    else
                                    //    {
                                    //        retailTransaction.PartnerData.PackingMaterial = "Y";

                                    //        if(IsCertificateItem(saleLineItem.ItemId))
                                    //        {
                                    //            if(iCF != (int)MetalType.Certificate)
                                    //            {
                                    //                using(LSRetailPosis.POSProcesses.frmMessage dialog1 = new LSRetailPosis.POSProcesses.frmMessage("Have you issued the certificate?", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
                                    //                {
                                    //                    LSRetailPosis.POSProcesses.POSFormsManager.ShowPOSForm(dialog1);
                                    //                    if(Convert.ToString(dialog1.DialogResult).ToUpper().Trim() == "NO")
                                    //                    {
                                    //                        preTriggerResult.ContinueOperation = false;
                                    //                        return;
                                    //                    }
                                    //                    else
                                    //                        retailTransaction.PartnerData.CertificateIssue = "Y";
                                    //                }
                                    //            }
                                    //            else
                                    //                retailTransaction.PartnerData.CertificateIssue = "Y";
                                    //        }
                                    //    }
                                    //}
                                    #endregion
                                    using (LSRetailPosis.POSProcesses.frmMessage dialog = new LSRetailPosis.POSProcesses.frmMessage("Proceed without packing material?", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
                                    {
                                        LSRetailPosis.POSProcesses.POSFormsManager.ShowPOSForm(dialog);
                                        if (Convert.ToString(dialog.DialogResult).ToUpper().Trim() == "NO")
                                        {
                                            preTriggerResult.ContinueOperation = false;
                                            return;
                                        }
                                    }
                                }
                                else
                                {
                                    retailTransaction.PartnerData.PackingMaterial = "Y";

                                    #region Commented
                                    //if(IsCertificateItem(saleLineItem.ItemId))
                                    //{
                                    //    if(iCF != (int)MetalType.Certificate)
                                    //    {
                                    //        using(LSRetailPosis.POSProcesses.frmMessage dialog1 = new LSRetailPosis.POSProcesses.frmMessage("Have you issued the certificate?", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
                                    //        {
                                    //            LSRetailPosis.POSProcesses.POSFormsManager.ShowPOSForm(dialog1);
                                    //            if(Convert.ToString(dialog1.DialogResult).ToUpper().Trim() == "NO")
                                    //            {
                                    //                preTriggerResult.ContinueOperation = false;
                                    //                return;
                                    //            }
                                    //            else
                                    //                retailTransaction.PartnerData.CertificateIssue = "Y";
                                    //        }
                                    //    }
                                    //    else
                                    //        retailTransaction.PartnerData.CertificateIssue = "Y";
                                    //}
                                    #endregion
                                }
                            }
                        }
                        #region Commented
                        //    else if(retailTransaction.PartnerData.CertificateIssue != "Y")
                        //    {
                        //        if(IsCertificateItem(saleLineItem.ItemId))
                        //        {
                        //            if(iCF != (int)MetalType.Certificate)
                        //            {
                        //                using(LSRetailPosis.POSProcesses.frmMessage dialog1 = new LSRetailPosis.POSProcesses.frmMessage("Have you issued the certificate?", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
                        //                {
                        //                    LSRetailPosis.POSProcesses.POSFormsManager.ShowPOSForm(dialog1);
                        //                    if(Convert.ToString(dialog1.DialogResult).ToUpper().Trim() == "NO")
                        //                    {
                        //                        preTriggerResult.ContinueOperation = false;
                        //                        return;
                        //                    }
                        //                    else
                        //                        retailTransaction.PartnerData.CertificateIssue = "Y";
                        //                }
                        //            }
                        //            else
                        //                retailTransaction.PartnerData.CertificateIssue = "Y";
                        //        }
                        //    }
                        #endregion
                    }
                }
            }
            // end: RH on 05/11/2014

            LSRetailPosis.ApplicationLog.Log("PaymentTriggers.PrePayment", "On the start of a payment operation...", LSRetailPosis.LogTraceLevel.Trace);

            switch ((PosisOperations)posOperation)
            {
            case PosisOperations.PayCash:
                // Insert code here...
                break;

            case PosisOperations.PayCard:
                // Insert code here...
                break;

            case PosisOperations.PayCheque:
                // Insert code here...
                break;

            case PosisOperations.PayCorporateCard:
                // Insert code here...
                break;

            case PosisOperations.PayCreditMemo:
                // Insert code here...
                break;

            case PosisOperations.PayCurrency:
                // Insert code here...
                break;

            case PosisOperations.PayCustomerAccount:
                // Insert code here...
                break;

            case PosisOperations.PayGiftCertificate:
                // Insert code here...
                break;

            case PosisOperations.PayLoyalty:
                // Insert code here...
                break;

                // etc.....
            }
        }
Exemplo n.º 3
0
        public void IssueCreditMemo(ICreditMemoTenderLineItem creditMemoItem, IRetailTransaction transaction)
        {
            if (creditMemoItem == null)
            {
                throw new ArgumentNullException("creditMemoItem");
            }

            RetailTransaction retailTransaction = transaction as RetailTransaction;

            if (retailTransaction == null)
            {
                throw new ArgumentNullException("retailTransaction");
            }
            else
            {
                if (retailTransaction.SaleIsReturnSale == true && retailTransaction.AmountDue < 0)
                {
                    InputConfirmation inC = new InputConfirmation();
                    inC.PromptText = "Remarks";
                    inC.InputType  = InputType.Normal;

                    Interaction.frmInput Oinput = new Interaction.frmInput(inC);
                    Oinput.ShowDialog();
                    if (!string.IsNullOrEmpty(Oinput.InputText))
                    {
                        retailTransaction.PartnerData.Remarks = Oinput.InputText;
                    }
                    else
                    {
                        retailTransaction.PartnerData.Remarks = "";
                    }
                }
            }

            try
            {
                LogMessage("Issuing a credit memo....", LogTraceLevel.Trace, "CreditMemo.IssueCreditMemo");

                bool   retVal           = false;
                string comment          = string.Empty;
                string creditMemoNumber = string.Empty;
                string currencyCode     = ApplicationSettings.Terminal.StoreCurrency;

                try
                {
                    // Begin by checking if there is a connection to the Transaction Service
                    this.Application.TransactionServices.CheckConnection();

                    // Publish the credit memo to the Head Office through the Transaction Services...
                    this.Application.TransactionServices.IssueCreditMemo(ref retVal, ref comment, ref creditMemoNumber,
                                                                         retailTransaction.StoreId,
                                                                         retailTransaction.TerminalId,
                                                                         retailTransaction.OperatorId,
                                                                         retailTransaction.TransactionId,
                                                                         retailTransaction.ReceiptId,
                                                                         "1",
                                                                         currencyCode,
                                                                         creditMemoItem.Amount * -1,
                                                                         DateTime.Now);

                    retailTransaction.CreditMemoItem.CreditMemoNumber = creditMemoNumber;
                    retailTransaction.CreditMemoItem.Amount           = creditMemoItem.Amount * -1;
                    creditMemoItem.SerialNumber = creditMemoNumber;
                    creditMemoItem.Comment      = creditMemoNumber;
                }
                catch (LSRetailPosis.PosisException px)
                {
                    // We cannot publish the credit memo to the HO, so we need to take action...

                    retailTransaction.TenderLines.RemoveLast();
                    retailTransaction.CalcTotals();

                    retailTransaction.CreditMemoItem = (CreditMemoItem)this.Application.BusinessLogic.Utility.CreateCreditMemoItem();

                    LSRetailPosis.ApplicationExceptionHandler.HandleException(this.ToString(), px);
                    throw;
                }
                catch (Exception x)
                {
                    // We cannot publish the credit memo to the HO, so we need to take action...

                    retailTransaction.TenderLines.RemoveLast();
                    retailTransaction.CalcTotals();
                    retailTransaction.CreditMemoItem = (CreditMemoItem)this.Application.BusinessLogic.Utility.CreateCreditMemoItem();

                    LSRetailPosis.ApplicationExceptionHandler.HandleException(this.ToString(), x);
                    throw new LSRetailPosis.PosisException(52300, x);
                }

                if (!retVal)
                {
                    LogMessage("Error storing the credit memo centrally...",
                               LSRetailPosis.LogTraceLevel.Error,
                               "CreditMemo.IssueCreditMemo");

                    retailTransaction.TenderLines.RemoveLast();
                    retailTransaction.CalcTotals();
                    retailTransaction.CreditMemoItem = (CreditMemoItem)this.Application.BusinessLogic.Utility.CreateCreditMemoItem();

                    throw new LSRetailPosis.PosisException(52300, new Exception(comment));
                }
            }
            catch (Exception x)
            {
                // Start :  On 14/07/2014
                foreach (SaleLineItem saleLineItem in retailTransaction.SaleItems)
                {
                    if (saleLineItem.ItemType == LSRetailPosis.Transaction.Line.SaleItem.BaseSaleItem.ItemTypes.Service)
                    {
                        updateCustomerAdvanceAdjustment(Convert.ToString(saleLineItem.PartnerData.ServiceItemCashAdjustmentTransactionID),
                                                        Convert.ToString(saleLineItem.PartnerData.ServiceItemCashAdjustmentStoreId),
                                                        Convert.ToString(saleLineItem.PartnerData.ServiceItemCashAdjustmentTerminalId), 0);
                    }
                }
                // End :  On 14/07/2014

                LSRetailPosis.ApplicationExceptionHandler.HandleException(this.ToString(), x);
                throw;
            }
        }