示例#1
0
        private bool PrepareNewSales(string strStatus = "")
        {
            if (txtSTxnNo.Text.Trim() != string.Empty && strStatus.Trim() != "" && Convert.ToString(cboSTxnStatusID.SelectedValue) != "V" && Convert.ToString(cboSTxnStatusID.SelectedValue) != "C")
            {
                string STxnStatusID = "";
                if (strStatus.Trim() == "ConfirmationN" ||
                    strStatus.Trim() == "ConfirmationS" ||
                    strStatus.Trim() == "ConfirmationL")
                {
                    if (strStatus.Trim() == "ConfirmationN")
                    {
                        if (Program.MsgBox_Show("You have choosen to create a new transaction. This action will suspend/void curret entry. Continue?", "Confirmation", "YesNo") == false)
                        {
                            return(false);
                        }
                        Program.PoleDisplay_Show(ldp_Hello);
                    }
                    else if (strStatus.Trim() == "ConfirmationS")
                    {
                        if (txtSTxnNo.Text.Trim() != string.Empty)
                        {
                            if (Program.MsgBox_Show("You have choosen to search transaction. This action will suspend/void current entry. Continue?", "Confirmation", "YesNo") == false)
                            {
                                return(false);
                            }
                        }
                        else
                        {
                            return(false);
                        }
                    }
                    else if (strStatus.Trim() == "ConfirmationL")
                    {
                        if (Program.MsgBox_Show("Are you sure you want to log out?", "Log Out Confirmation", "YesNo") == false)
                        {
                            return(false);
                        }
                    }


                    using (var frm = new ChooseTransactionStatusForm())
                    {
                        STxnStatusID = frm.Search(txtSTxnNo.Text.Trim());
                    }

                    if (STxnStatusID == null)
                    {
                        return(false);
                    }

                    if (STxnStatusID.Trim() == "V")
                    {
                        var oPaymentHd = new PaymentHd();
                        if (oPaymentHd.LoadBySTxnNo(txtSTxnNo.Text.Trim()))
                        {
                            Program.MsgBox_Show("This transaction already have payment. Please complete/void it's payment first.");
                            return(false);
                        }
                        oPaymentHd.Dispose();
                        oPaymentHd = null;


                        using (var frm = new AuthorizeForm())
                        {
                            if (!frm.GetAuthorize())
                            {
                                return(false);
                            }
                        }
                    }
                }
                else if (strStatus.Trim() == "Complete")
                {
                    STxnStatusID = "C";
                    Program.PoleDisplay_Show(ldp_Hello);
                }
                else
                {
                    return(false);
                }

                UpdateTransaction(STxnStatusID, true, (STxnStatusID != "C"));
            }
            cboSTxnStatusID.SelectedValue = "O";

            txtSTxnNo.Text = string.Empty;

            txtSTxnDate.Text          = string.Format(Program.FormatDate, BussinessRules.ID.GetDateDBServer());
            lblSystemCurrentDate.Text = string.Format(Program.FormatDate, BussinessRules.ID.GetDateDBServer());
            lblSystemCurrentTime.Text = string.Format(Program.FormatTime, BussinessRules.ID.GetDateDBServer());

            //Member Entry
            ClearMemberEntry();

            //Item Entry
            ClearItemEntry();
            lblItemName.Text      = "-";
            lblItemUnitPrice.Text = String.Format(Program.FormatCurrency, 0);

            //Detil
            lblLines.Text = "0";
            lblItems.Text = "0";
            _dtbSalesItem = LoadSalesItem();
            PopulateGridAndTotal();
            return(true);
        }
示例#2
0
        private void Payment()
        {
            var IsDonationOnly = false;

            if (txtSTxnNo.Text.Trim() == "")
            {
                if (Program.MsgBox_Show("Do you wish to perform a Donation Only transaction ?", "Confirmation", "YesNo"))
                {
                    IsDonationOnly = true;
                }
                else
                {
                    IsDonationOnly = false;
                    return;
                }
                //MessageBox.Show("No transaction to be paid.");
            }

            string receiptNo = string.Empty;
            var    paymentHd = new PaymentHd();

            if (paymentHd.LoadBySTxnNo(txtSTxnNo.Text))
            {
                receiptNo = paymentHd.ReceiptNo;
            }
            paymentHd.Dispose();
            paymentHd = null;

            if (Convert.ToString(cboSTxnStatusID.SelectedValue) == "O" ||
                Convert.ToString(cboSTxnStatusID.SelectedValue) == "S")
            {
                UpdateTransaction(Convert.ToString(cboSTxnStatusID.SelectedValue), false, true);
            }

            decimal DonationAmt      = 0;
            decimal GetVoucherAmount = 0;
            var     oSalesUnitHd     = new SalesUnitHd();

            oSalesUnitHd.STxnNo = txtSTxnNo.Text.Trim();
            if (oSalesUnitHd.SelectOne().Rows.Count > 0)
            {
                DonationAmt      = oSalesUnitHd.DonationAmt;
                GetVoucherAmount = oSalesUnitHd.GetVoucherAmount;
            }
            oSalesUnitHd.Dispose();
            oSalesUnitHd = null;

            using (var frm = new POSPaymentForm(_loginInfo))
            {
                var _LastTransaction = frm.Payment(lblSystemCurrentDate.Text.Trim(), lblSystemCurrentTime.Text.Trim(), txtSTxnNo.Text.Trim(),
                                                   txtSTxnDate.Text.Trim(), receiptNo.Trim(), txtMemberID.Text.Trim(), lblMemberName.Text.Trim(),
                                                   lblMemberSinceDate.Text.Trim(), lblValidThruDate.Text.Trim(), Convert.ToDecimal(txtGrandTotal.Text),
                                                   Convert.ToString(cboSTxnStatusID.SelectedValue), IsDonationOnly, Convert.ToString(cbotranstype.SelectedValue),
                                                   Convert.ToString(cboWh.SelectedValue), Convert.ToString(cboUnit.SelectedValue), Convert.ToString(cboCurrency.SelectedValue),
                                                   Convert.ToDecimal(txtCurrencyRate.Text.Trim()), DonationAmt, GetVoucherAmount);

                if (_LastTransaction.Length == 7)
                {
                    lblLastSTxnNo.Text     = _LastTransaction[0]; //"TransactionNo"
                    lblLastGrandTotal.Text = _LastTransaction[1]; //"GrandTotal"
                    lblLastRounding.Text   = _LastTransaction[2]; //"Rounding"
                    lblLastPayment.Text    = _LastTransaction[3]; //"Payment"
                    lblLastChange.Text     = _LastTransaction[4]; //"Change"

                    if (Convert.ToBoolean(_LastTransaction[6]))
                    {
                        txtSTxnNo.Text = _LastTransaction[5];
                    }

                    PrepareNewSales("Complete");
                }
                else if (_LastTransaction.Length == 2)
                {
                    if (Convert.ToBoolean(_LastTransaction[1]))
                    {
                        txtSTxnNo.Text = _LastTransaction[0];
                        UpdateTransaction("V", true, false);
                        PrepareNewSales();
                    }
                }

                if (txtSTxnNo.Text.Trim() != string.Empty)
                {
                    Program.PoleDisplay_Show(ldp_DefaultText);
                }
            }
        }