示例#1
0
        private void ContactAdd()
        {
            if (!TerminalDetails.ShowCustomerSelection)
            {
                ContactAddDetWnd addwnd = new ContactAddDetWnd();
                addwnd.Caption = "Quickly add new customer.";
                addwnd.ShowDialog(this);
                DialogResult        addresult = addwnd.Result;
                Data.ContactDetails details   = addwnd.ContactDetails;
                addwnd.Close();
                addwnd.Dispose();

                if (addresult == DialogResult.OK)
                {
                    txtSearch.Text = details.ContactCode;
                    LoadContactData();
                }
            }
            else
            {
                ContactAddWnd addwnd = new ContactAddWnd();
                addwnd.Caption = "Quickly add new customer.";
                addwnd.ShowDialog(this);
                DialogResult        addresult = addwnd.Result;
                Data.ContactDetails details   = addwnd.ContactDetails;
                addwnd.Close();
                addwnd.Dispose();

                if (addresult == DialogResult.OK)
                {
                    txtSearch.Text = details.ContactCode;
                    LoadContactData();
                }
            }
        }
示例#2
0
        private void SelectContact()
        {
            try
            {
                ContactSelectWnd clsContactWnd = new ContactSelectWnd();
                clsContactWnd.EnableContactAddUpdate = false;
                clsContactWnd.SysConfigDetails       = SysConfigDetails;
                clsContactWnd.TerminalDetails        = TerminalDetails;
                clsContactWnd.ContactGroupCategory   = AceSoft.RetailPlus.Data.ContactGroupCategory.CUSTOMER;
                clsContactWnd.ShowDialog(this);
                Data.ContactDetails details = clsContactWnd.Details;
                DialogResult        result  = clsContactWnd.Result;
                clsContactWnd.Close();
                clsContactWnd.Dispose();

                if (clsContactWnd.Result == DialogResult.OK)
                {
                    if (details.ContactID <= Constants.C_RETAILPLUS_CUSTOMERID)
                    {
                        MessageBox.Show("Sorry, you cannot use the default customer." +
                                        "Please select another customer...", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        SelectContact();
                    }
                    else
                    {
                        txtContact.Text = details.ContactName;
                        txtContact.Tag  = details.ContactID.ToString();
                    }
                }
            }
            catch { }
        }
示例#3
0
        private void cmdTable_Click(object sender, EventArgs e)
        {
            try
            {
                ProductButton cmdTable = (ProductButton)sender;

                Data.Contacts       clsContact        = new Contacts();
                Data.ContactDetails clsContactDetails = clsContact.Details(long.Parse(cmdTable.Tag.ToString()));
                clsContact.CommitAndDispose();

                if (mlstTables.Exists(i => i.ContactID == clsContactDetails.ContactID))
                {
                    mlstTables.Remove(clsContactDetails);
                    cmdTable.Controls["lblMerge" + cmdTable.Name.Replace("cmdTable", "")].Visible = false;

                    if (cmdTable.GradientBottom == System.Drawing.Color.DarkRed)
                    {
                        cmdTable.GradientTop = System.Drawing.Color.Red;
                    }
                    else
                    {
                        cmdTable.GradientTop = System.Drawing.Color.LightBlue;
                    }
                }
                else
                {
                    mlstTables.Add(clsContactDetails);
                    cmdTable.Controls["lblMerge" + cmdTable.Name.Replace("cmdTable", "")].Visible = true;
                    cmdTable.Controls["lblMerge" + cmdTable.Name.Replace("cmdTable", "")].Text    = "Merged to " + MainTableToMerge.ContactCode;
                    cmdTable.GradientTop = System.Drawing.Color.Orange;
                }
            }
            catch { }
        }
示例#4
0
        private void LoadContactData()
        {
            Contacts clsContact = new Contacts();

            try
            {
                string searchkey = "" + txtSearch.Text;

                System.Data.DataTable dt;
                if (mContactGroupCategory == ContactGroupCategory.AGENT)
                {
                    dt = clsContact.AgentsAsDataTable(searchkey, 50, "ContactName", SortOption.Ascending);
                }
                else
                {
                    dt = clsContact.CustomersDataTable(searchkey, 50, HasCreditOnly, "ContactName", SortOption.Ascending);
                }

                if (!TerminalDetails.ShowCustomerSelection && dt.Rows.Count == 0)
                {
                    Data.ContactDetails clsContactDetails = clsContact.DetailsByCreditCardNo(txtSearch.Text);

                    //remove this coz it's slow
                    //if (clsContactDetails.ContactID == 0 && txtSearch.Text.Length == 7) clsContactDetails = clsContact.DetailsByCreditCardNo("888880" + txtSearch.Text);
                    //if (clsContactDetails.ContactID == 0 && txtSearch.Text.Length == 7) clsContactDetails = clsContact.DetailsByCreditCardNo("800000" + txtSearch.Text);
                    //if (clsContactDetails.ContactID == 0 && txtSearch.Text.Length == 9) clsContactDetails = clsContact.DetailsByCreditCardNo(BarcodeHelper.GroupCreditCard_Country_Code + BarcodeHelper.GroupCreditCard_ManufacturerCode + txtSearch.Text);
                    //if (clsContactDetails.ContactID == 0 && txtSearch.Text.Length == 9) clsContactDetails = clsContact.DetailsByCreditCardNo(BarcodeHelper.CustomerCode_Country_Code + BarcodeHelper.CustomerCode_ManufacturerCode + txtSearch.Text);
                    //if (clsContactDetails.ContactID == 0 && txtSearch.Text.Length == 9) clsContactDetails = clsContact.DetailsByCreditCardNo(BarcodeHelper.GroupCreditCard_Country_Code + BarcodeHelper.GroupCreditCard_ManufacturerCode_Manual + txtSearch.Text);
                    //if (clsContactDetails.ContactID == 0 && txtSearch.Text.Length == 9) clsContactDetails = clsContact.DetailsByCreditCardNo(BarcodeHelper.CreditCard_Country_Code + BarcodeHelper.CreditCard_ManufacturerCode + txtSearch.Text);

                    if (clsContactDetails.ContactID != 0)
                    {
                        searchkey = clsContactDetails.ContactCode;

                        if (mContactGroupCategory == ContactGroupCategory.AGENT)
                        {
                            dt = clsContact.AgentsAsDataTable(searchkey, 50, "ContactName", SortOption.Ascending);
                        }
                        else
                        {
                            dt = clsContact.CustomersDataTable(searchkey, 50, HasCreditOnly, "ContactName", SortOption.Ascending);
                        }
                    }
                }
                clsContact.CommitAndDispose();

                this.dgStyle.MappingName = dt.TableName;
                dgContacts.DataSource    = dt;
                dgContacts.Select(0);
                dgContacts.CurrentRowIndex = 0;
            }
            catch (IndexOutOfRangeException) {}
            catch (Exception ex)
            {
                clsContact.CommitAndDispose();
                MessageBox.Show(ex.Message, "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#5
0
        private void ContactAdd()
        {
            if (!EnableContactAddUpdate)
            {
                return;
            }

            Data.ContactDetails details   = new Data.ContactDetails();
            DialogResult        addresult = System.Windows.Forms.DialogResult.Cancel;

            switch (SysConfigDetails.ContactAddWndType)
            {
            case ContactAddWndType.ContactAddWnd:
            case ContactAddWndType.ContactAddNoLTOWnd:
                ContactAddWnd clsContactAddWnd = new ContactAddWnd();
                clsContactAddWnd.Caption          = "Quickly add new customer.";
                clsContactAddWnd.ContactDetails   = details;
                clsContactAddWnd.TerminalDetails  = TerminalDetails;
                clsContactAddWnd.SysConfigDetails = SysConfigDetails;
                clsContactAddWnd.ShowDialog(this);
                addresult = clsContactAddWnd.Result;
                details   = clsContactAddWnd.ContactDetails;
                clsContactAddWnd.Close();
                clsContactAddWnd.Dispose();
                break;

            case ContactAddWndType.ContactAddHCareWnd:
                ContactAddHCareWnd clsContactAddHCareWnd = new ContactAddHCareWnd();
                clsContactAddHCareWnd.Caption         = "Quickly add new customer.";
                clsContactAddHCareWnd.ContactDetails  = details;
                clsContactAddHCareWnd.TerminalDetails = TerminalDetails;
                clsContactAddHCareWnd.ShowDialog(this);
                addresult = clsContactAddHCareWnd.Result;
                details   = clsContactAddHCareWnd.ContactDetails;
                clsContactAddHCareWnd.Close();
                clsContactAddHCareWnd.Dispose();
                break;

            default:
                ContactAddDetWnd clsContactAddDetWnd = new ContactAddDetWnd();
                clsContactAddDetWnd.Caption         = "Quickly add new customer.";
                clsContactAddDetWnd.ContactDetails  = details;
                clsContactAddDetWnd.TerminalDetails = TerminalDetails;
                clsContactAddDetWnd.ShowDialog(this);
                addresult = clsContactAddDetWnd.Result;
                details   = clsContactAddDetWnd.ContactDetails;
                clsContactAddDetWnd.Close();
                clsContactAddDetWnd.Dispose();
                break;
            }

            if (addresult == DialogResult.OK)
            {
                txtSearch.Text = details.ContactCode;
                LoadContactData();
            }
        }
示例#6
0
        public int Post(Core.ContactDetails contactDetails)
        {
            Data.ContactDetails contact = mapper.Map <Data.ContactDetails>(contactDetails);


            var insertPetapoco = database.Insert(contact); //Petapoco

            var insertDapper = connection.Insert(contact); //Dapper

            return((int)insertDapper);
        }
示例#7
0
        private bool SaveRecord()
        {
            Data.ContactDetails clsDetails = new Data.ContactDetails();
            clsDetails = mContactDetails;

            clsDetails.ContactCode  = txtCustomerName.Text;
            clsDetails.ContactName  = txtCustomerName.Text;
            clsDetails.Address      = txtAddress.Text;
            clsDetails.BusinessName = txtBusinessName.Text;
            clsDetails.TelephoneNo  = txtTelNo.Text;

            // Jul 22, 2014
            clsDetails.Debit           = mContactDetails.Debit;
            clsDetails.Credit          = mContactDetails.Credit;
            clsDetails.IsCreditAllowed = chkIsCreditAllowed.Checked;
            clsDetails.CreditLimit     = decimal.Parse(txtCreditLimit.Text);
            clsDetails.Terms           = int.Parse(txtTerms.Text);
            clsDetails.ModeOfTerms     = (ModeOfTerms)Enum.Parse(typeof(ModeOfTerms), cboTerms.SelectedItem.ToString());

            Data.Contacts clsContact = new Data.Contacts();
            if (mContactDetails.ContactID == 0)
            {
                if (mstCaption == "Please enter customer name for deposit.")
                {
                    clsDetails.Remarks = Data.Contacts.DEFAULT_REMARKS_FOR_ADDED_FROM_DEPOSIT;
                }
                else if (mstCaption == "Quickly add new customer")
                {
                    clsDetails.Remarks = Data.Contacts.DEFAULT_REMARKS_FOR_QUICKLY_ADDED_FROM_FE;
                }
                else if (mContactDetails.ContactID == 0) // means not edit
                {
                    clsDetails.Remarks = Data.Contacts.DEFAULT_REMARKS_FOR_ADDED_FROM_CLIENT;
                }

                clsDetails.ContactGroupID = Constants.CONTACT_GROUP_CUSTOMER;
                clsDetails.PositionID     = Constants.C_RETAILPLUS_AGENT_POSITIONID;
                clsDetails.DepartmentID   = Constants.C_RETAILPLUS_AGENT_DEPARTMENTID;
                clsDetails.ContactID      = clsContact.Insert(clsDetails);
            }
            else
            {
                clsDetails.ContactCode      = mContactDetails.ContactCode;
                clsDetails.ContactGroupID   = mContactDetails.ContactGroupID;
                clsDetails.ContactGroupName = mContactDetails.ContactGroupName;
                clsContact.Update(clsDetails);
            }
            clsContact.CommitAndDispose();

            mContactDetails = clsDetails;

            return(true);
        }
示例#8
0
        protected void cboSupplier_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            Data.Contacts       clsContact = new Data.Contacts();
            Data.ContactDetails clsDetails = clsContact.Details(Convert.ToInt64(cboSupplier.SelectedItem.Value));
            clsContact.CommitAndDispose();

            txtSupplierContact.Text     = clsDetails.ContactName;
            txtSupplierTelephoneNo.Text = clsDetails.TelephoneNo;
            lblTerms.Text           = clsDetails.Terms.ToString("##0");
            lblModeOfterms.Text     = clsDetails.ModeOfTerms.ToString("G");
            txtSupplierAddress.Text = clsDetails.Address;
        }
示例#9
0
        private void ContactAdd()
        {
            Data.ContactDetails details = new Data.ContactDetails();

            System.Windows.Forms.DialogResult addresult = System.Windows.Forms.DialogResult.Cancel;

            switch (SysConfigDetails.ContactAddWndType)
            {
            case ContactAddWndType.ContactAddWnd:
                ContactAddWnd clsContactAddWnd = new ContactAddWnd();
                clsContactAddWnd.Caption         = "Please enter customer name for deposit.";
                clsContactAddWnd.ContactDetails  = details;
                clsContactAddWnd.TerminalDetails = TerminalDetails;
                clsContactAddWnd.ShowDialog(this);
                addresult = clsContactAddWnd.Result;
                details   = clsContactAddWnd.ContactDetails;
                clsContactAddWnd.Close();
                clsContactAddWnd.Dispose();
                break;

            case ContactAddWndType.ContactAddHCareWnd:
                ContactAddHCareWnd clsContactAddHCareWnd = new ContactAddHCareWnd();
                clsContactAddHCareWnd.Caption         = "Please enter customer name for deposit.";
                clsContactAddHCareWnd.ContactDetails  = details;
                clsContactAddHCareWnd.TerminalDetails = TerminalDetails;
                clsContactAddHCareWnd.ShowDialog(this);
                addresult = clsContactAddHCareWnd.Result;
                details   = clsContactAddHCareWnd.ContactDetails;
                clsContactAddHCareWnd.Close();
                clsContactAddHCareWnd.Dispose();
                break;

            default:
                ContactAddDetWnd clsContactAddDetWnd = new ContactAddDetWnd();
                clsContactAddDetWnd.Caption         = "Please enter customer name for deposit.";
                clsContactAddDetWnd.ContactDetails  = details;
                clsContactAddDetWnd.TerminalDetails = TerminalDetails;
                clsContactAddDetWnd.ShowDialog(this);
                addresult = clsContactAddDetWnd.Result;
                details   = clsContactAddDetWnd.ContactDetails;
                clsContactAddDetWnd.Close();
                clsContactAddDetWnd.Dispose();
                break;
            }

            if (addresult == DialogResult.OK)
            {
                txtContact.Text = details.ContactName;
                txtContact.Tag  = details.ContactID.ToString();
            }
        }
示例#10
0
        protected void cboContact_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            try
            {
                if (cboContact.SelectedItem.Value != Constants.ZERO_STRING)
                {
                    ContactColumns clsContactColumns = new ContactColumns();
                    clsContactColumns.ContactID     = true;
                    clsContactColumns.ContactCode   = true;
                    clsContactColumns.ContactName   = true;
                    clsContactColumns.CreditDetails = true;

                    ContactColumns clsSearchColumns = new ContactColumns();
                    clsSearchColumns.ContactCode   = true;
                    clsSearchColumns.ContactName   = true;
                    clsSearchColumns.CreditDetails = true;

                    Int64 iGuarantorID = Int64.Parse(cboContact.SelectedItem.Value);

                    Contacts              clsContact        = new Contacts();
                    Data.ContactDetails   clsContactDetails = clsContact.Details(iGuarantorID);
                    System.Data.DataTable dt = clsContact.CustomersWithCredits(clsContactColumns, iGuarantorID, SortField: "CreditCardNo"); //  "", dteExpiryDateFrom, dteExpiryDateTo, enumCreditCardStatus, Int32.Parse(cboCreditType.SelectedItem.Value),
                    clsContact.CommitAndDispose();

                    lstItemCustomer.DataSource = dt.DefaultView;
                    lstItemCustomer.DataBind();

                    txtCreditCardTypeCode.Text    = clsContactDetails.CreditDetails.CardTypeDetails.CardTypeCode;
                    txtCreditCardTypeCode.ToolTip = clsContactDetails.CreditDetails.CardTypeDetails.CardTypeID.ToString();

                    divGuarantorInfo.Visible = true;
                }
                else
                {
                    divGuarantorInfo.Visible = false;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#11
0
        private void CreateDetails(int iRow)
        {
            mDetails = new ContactDetails();
            Customer clsCustomer = new Customer();

            mDetails = clsCustomer.Details(Convert.ToInt64(dgContacts[iRow, 0].ToString()));
            clsCustomer.CommitAndDispose();

            ////int iRow = dgContacts.CurrentRowIndex;

            //mDetails.ContactID = Convert.ToInt64(dgContacts[iRow, 0].ToString());
            //mDetails.ContactCode = dgContacts[iRow, 1].ToString();
            //mDetails.ContactName = dgContacts[iRow, 2].ToString();
            //mDetails.Debit = Convert.ToDecimal(dgContacts[iRow, 3].ToString());
            //mDetails.Credit = Convert.ToDecimal(dgContacts[iRow, 4].ToString());
            //mDetails.CreditLimit = Convert.ToDecimal(dgContacts[iRow, 5].ToString());
            //mDetails.IsCreditAllowed = Convert.ToInt16(dgContacts[iRow, 6].ToString());
            //mDetails.PositionName = dgContacts[iRow, 7].ToString();
            //mDetails.DepartmentName = dgContacts[iRow, 8].ToString();
        }
示例#12
0
        protected void cboPayee_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            long payeeid = Convert.ToInt64(cboPayee.SelectedItem.Value);

            Data.Contacts       clsContact = new Data.Contacts();
            Data.ContactDetails clsDetails = clsContact.Details(payeeid);
            clsContact.CommitAndDispose();

            txtPayeeName.Text = clsDetails.ContactName;

            DataClass clsDataClass = new DataClass();

            PO clsPO = new PO();

            lstPO.DataSource = clsDataClass.DataReaderToDataTable(clsPO.ListForPayment(payeeid, "POID", SortOption.Ascending)).DefaultView;
            lstPO.DataBind();
            clsPO.CommitAndDispose();

            Label lblAmount;
            Label lblPaidAmount;
            Label lblUnpaidAmount;

            decimal decAmount       = 0;
            decimal decPaidAmount   = 0;
            decimal decUnpaidAmount = 0;

            foreach (DataListItem item in lstPO.Items)
            {
                lblAmount       = (Label)item.FindControl("lblAmount");
                lblPaidAmount   = (Label)item.FindControl("lblPaidAmount");
                lblUnpaidAmount = (Label)item.FindControl("lblUnpaidAmount");

                decAmount       += Convert.ToDecimal(lblAmount.Text);
                decPaidAmount   += Convert.ToDecimal(lblPaidAmount.Text);
                decUnpaidAmount += Convert.ToDecimal(lblUnpaidAmount.Text);
            }

            lblPOTotalAmount.Text       = decAmount.ToString("#,##0.#0");
            lblPOTotalPaidAmount.Text   = decPaidAmount.ToString("#,##0.#0");
            lblPOTotalUnpaidAmount.Text = decUnpaidAmount.ToString("#,##0.#0");
        }
示例#13
0
        private void cmdTable_Click(object sender, EventArgs e)
        {
            try
            {
                ProductButton cmdTable = (ProductButton)sender;

                Data.Contacts clsContact = new Contacts();
                mDetails = clsContact.Details(long.Parse(cmdTable.Tag.ToString()));

                Data.SalesTransactions clsSalesTransactions = new Data.SalesTransactions(clsContact.Connection, clsContact.Transaction);
                string stTransactionNo = clsSalesTransactions.getSuspendedTransactionNo(mDetails.ContactID, mclsTerminalDetails.TerminalNo, mclsTerminalDetails.BranchID);
                Data.SalesTransactionDetails clsSalesTransactionDetails = new SalesTransactionDetails();
                if (!string.IsNullOrEmpty(stTransactionNo))
                {
                    clsSalesTransactionDetails = clsSalesTransactions.Details(stTransactionNo, mclsTerminalDetails.TerminalNo, mclsTerminalDetails.BranchID);
                }
                clsContact.CommitAndDispose();

                if (!string.IsNullOrEmpty(stTransactionNo) && clsSalesTransactionDetails.TransactionStatus == TransactionStatus.SuspendedOpen)
                {
                    if (MessageBox.Show("This transaction is already open in another terminal. Please suspend in the other terminal first before opening." + Environment.NewLine + "Would you like to force open this transaction?", "RetailPlus", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.No)
                    {
                        //LoadContactData(System.Data.SqlClient.SortOrder.Ascending);
                        return;
                    }
                    else
                    {
                        DialogResult resResumeSuspendedOpenTransaction = GetWriteAccessAndLogin(CashierID, AccessTypes.ResumeSuspendedOpenTransaction);

                        if (resResumeSuspendedOpenTransaction != System.Windows.Forms.DialogResult.OK)
                        {
                            //LoadContactData(System.Data.SqlClient.SortOrder.Ascending);
                            return;
                        }
                    }
                }
                dialog = DialogResult.OK;
                this.Hide();
            }
            catch { }
        }
示例#14
0
        private void cboCardType_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (cboCardType.Text == "No available cards to issue")
            {
                grpCardInfo.Visible = false;
            }
            else
            {
                Data.CardType        clsCardType        = new Data.CardType();
                Data.CardTypeDetails clsCardTypeDetails = clsCardType.Details(cboCardType.Text);
                clsCardType.CommitAndDispose();

                if (clsCardTypeDetails.CardTypeID == 0)
                {
                    grpCardInfo.Visible = false;
                    CardTypeDetails     = new Data.CardTypeDetails();
                }
                else
                {
                    grpCardInfo.Visible          = true;
                    grpCardInfo.Text             = cboCardType.Text + " Information";
                    lblCardTypeCode.Text         = clsCardTypeDetails.CardTypeCode;
                    lblFinanceCharge.Text        = clsCardTypeDetails.CreditFinanceCharge.ToString("##0.#0");
                    lblPenaltyCharge.Text        = clsCardTypeDetails.CreditLatePenaltyCharge.ToString("##0.#0");
                    lblMinimumPercentageDue.Text = clsCardTypeDetails.CreditMinimumPercentageDue.ToString("##0.#0");
                    lblMinimumAmountDue.Text     = clsCardTypeDetails.CreditMinimumAmountDue.ToString("##0.#0");
                    chkWithGuarantor.Checked     = clsCardTypeDetails.WithGuarantor;

                    CardTypeDetails = clsCardTypeDetails;

                    if (!clsCardTypeDetails.WithGuarantor)
                    {
                        mclsGuarantor = new Data.ContactDetails();
                    }
                    else
                    {
                    }
                }
            }
        }
示例#15
0
        protected void cboContact_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            try
            {
                if (cboContact.SelectedItem.Value != Constants.ZERO_STRING)
                {
                    ContactColumns clsContactColumns = new ContactColumns();
                    clsContactColumns.ContactID     = true;
                    clsContactColumns.ContactCode   = true;
                    clsContactColumns.ContactName   = true;
                    clsContactColumns.CreditDetails = true;

                    ContactColumns clsSearchColumns = new ContactColumns();
                    clsSearchColumns.ContactCode   = true;
                    clsSearchColumns.ContactName   = true;
                    clsSearchColumns.CreditDetails = true;

                    Int64 iContactID = Int64.Parse(cboContact.SelectedItem.Value);

                    Contacts            clsContact          = new Contacts();
                    Data.ContactDetails clsContactDetails   = clsContact.Details(iContactID);
                    Data.ContactDetails clsGuarantorDetails = clsContact.Details(clsContactDetails.CreditDetails.GuarantorID);
                    clsContact.CommitAndDispose();

                    txtGuarantorName.Text    = clsGuarantorDetails.ContactName.ToString();
                    txtGuarantorName.ToolTip = clsGuarantorDetails.ContactID.ToString();

                    divContactInfo.Visible = true;
                }
                else
                {
                    divContactInfo.Visible = false;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#16
0
        private bool SaveRecord()
        {
            Data.ContactDetails clsDetails = new Data.ContactDetails();
            clsDetails.ContactCode    = txtCustomerName.Text;
            clsDetails.ContactName    = txtCustomerName.Text;
            clsDetails.ContactGroupID = Constants.CONTACT_GROUP_CUSTOMER;
            clsDetails.ModeOfTerms    = 0;
            clsDetails.Terms          = 0;
            clsDetails.Address        = txtAddress.Text;
            clsDetails.BusinessName   = txtBusinessName.Text;
            clsDetails.TelephoneNo    = txtTelNo.Text;
            if (mstCaption == "Please enter customer name for deposit.")
            {
                clsDetails.Remarks = Data.Contacts.DEFAULT_REMARKS_FOR_ADDED_FROM_DEPOSIT;
            }
            else if (mstCaption == "Quickly add new customer")
            {
                clsDetails.Remarks = Data.Contacts.DEFAULT_REMARKS_FOR_QUICKLY_ADDED_FROM_FE;
            }
            else
            {
                clsDetails.Remarks = Data.Contacts.DEFAULT_REMARKS_FOR_ADDED_FROM_CLIENT;
            }
            clsDetails.Debit           = 0;
            clsDetails.Credit          = 0;
            clsDetails.IsCreditAllowed = true;
            clsDetails.CreditLimit     = 0;
            clsDetails.PositionID      = Constants.C_RETAILPLUS_AGENT_POSITIONID;
            clsDetails.DepartmentID    = Constants.C_RETAILPLUS_AGENT_DEPARTMENTID;

            Data.Contacts clsContact = new Data.Contacts();
            clsDetails.ContactID = clsContact.Insert(clsDetails);
            clsContact.CommitAndDispose();

            mContactDetails = clsDetails;

            return(true);
        }
示例#17
0
		private void IssueCreditCard()
		{
			if (mboIsInTransaction)
			{
				MessageBox.Show("Sorry you cannot issue a Credit Card while there is an ongoing transaction. Please finish the transaction first.", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Warning);
				return;
			}

			DialogResult loginresult = GetWriteAccessAndLogin(mclsSalesTransactionDetails.CashierID, AccessTypes.CreditCardIssuance);

			if (loginresult == DialogResult.OK)
			{
				try
				{
					DialogResult result;
                    Data.CardTypeDetails clsCardTypeDetails = new Data.CardTypeDetails();
                    Data.ContactDetails clsGuarantorDetails = new AceSoft.RetailPlus.Data.ContactDetails();
                    ContactCreditTypeSelectWnd clsContactCreditTypeSelectWnd = new ContactCreditTypeSelectWnd();
                    clsContactCreditTypeSelectWnd.TerminalDetails = mclsTerminalDetails;
                    clsContactCreditTypeSelectWnd.ShowDialog(this);
                    clsCardTypeDetails = clsContactCreditTypeSelectWnd.CardTypeDetails;
                    result = clsContactCreditTypeSelectWnd.Result;
                    clsContactCreditTypeSelectWnd.Close();
                    clsContactCreditTypeSelectWnd.Dispose();

                    if (result != DialogResult.OK)
                    { return; }

					Data.ContactDetails clsContactDetails;
					ContactSelectWnd clsContactWnd = new ContactSelectWnd();
                    clsContactWnd.EnableContactAddUpdate = GetWriteAccess(mclsSalesTransactionDetails.CashierID, AccessTypes.Contacts) == System.Windows.Forms.DialogResult.OK;
                    clsContactWnd.SysConfigDetails = mclsSysConfigDetails;
                    clsContactWnd.TerminalDetails = mclsTerminalDetails;

                    if (clsCardTypeDetails.WithGuarantor)
					{
                        MessageBox.Show("Please select a GUARANTOR to issue Credit Card.", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Information);

						clsContactWnd.ContactGroupCategory = AceSoft.RetailPlus.Data.ContactGroupCategory.CUSTOMER;
                        clsContactWnd.Header = "Select GUARANTOR to issue Credit Card.";
						clsContactWnd.ShowDialog(this);
						clsGuarantorDetails = clsContactWnd.Details;
						result = clsContactWnd.Result;
						clsContactWnd.Close();
						clsContactWnd.Dispose();
						
						if (result != DialogResult.OK)
						{ return; }

						MessageBox.Show(clsGuarantorDetails.ContactName + " has been selected as guarantor." + Environment.NewLine + "Please select the CUSTOMER to issue Credit Card.", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Information);
					}
					clsContactWnd = new ContactSelectWnd();
                    clsContactWnd.EnableContactAddUpdate = GetWriteAccess(mclsSalesTransactionDetails.CashierID, AccessTypes.Contacts) == System.Windows.Forms.DialogResult.OK;
                    clsContactWnd.SysConfigDetails = mclsSysConfigDetails;
                    clsContactWnd.TerminalDetails = mclsTerminalDetails;
					clsContactWnd.ContactGroupCategory = AceSoft.RetailPlus.Data.ContactGroupCategory.CUSTOMER;
                    clsContactWnd.Header = "Select CUSTOMER to issue Credit Card.";
					clsContactWnd.ShowDialog(this);
					clsContactDetails = clsContactWnd.Details;
					result = clsContactWnd.Result;
					clsContactWnd.Close();
					clsContactWnd.Dispose();

					if (result != DialogResult.OK)
					{ return; }

					if (clsContactDetails.ContactID == Constants.ZERO || clsContactDetails.ContactID == Constants.C_RETAILPLUS_CUSTOMERID)
					{ return; }

                    // if no guarantor
                    if (!clsCardTypeDetails.WithGuarantor) clsGuarantorDetails = new Data.ContactDetails();

					clsEvent.AddEvent("[" + lblCashier.Text + "] Issuing credit card no to " + clsContactDetails.ContactName);

					Data.Contacts clsContact = new Data.Contacts(mConnection, mTransaction);
                    mConnection = clsContact.Connection; mTransaction = clsContact.Transaction;

					clsContactDetails = clsContact.Details(clsContactDetails.ContactID);
					clsContact.CommitAndDispose();

					if (clsContactDetails.CreditDetails.CreditCardNo != string.Empty && clsContactDetails.CreditDetails.CreditCardNo != null)
					{
						clsEvent.AddEventLn("Cancelled!");
						clsEvent.AddEventLn("Credit Card No: " + clsContactDetails.CreditDetails.CreditCardNo + " was already issued to " + clsContactDetails.ContactName + " on " + clsContactDetails.CreditDetails.CreditAwardDate.ToString("MMM dd, yyyy hh:mm tt"));
						MessageBox.Show("Credit Card No: " + clsContactDetails.CreditDetails.CreditCardNo + " was already issued to " + clsContactDetails.ContactName + " on " + clsContactDetails.CreditDetails.CreditAwardDate.ToString("MMM dd, yyyy hh:mm tt") + "." +
                                        Environment.NewLine + " Please select another customer to issue Credit Card.", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Error);
						return;
					}

					clsEvent.AddEvent("[" + lblCashier.Text + "] Issuing credit card no to " + clsContactDetails.ContactName);

					ContactCreditWnd clsContactCreditWnd = new ContactCreditWnd();
					clsContactCreditWnd.Header = "Credit Card Issuance";
                    clsContactCreditWnd.CardTypeDetails = clsCardTypeDetails;
					clsContactCreditWnd.Guarantor = clsGuarantorDetails;
					clsContactCreditWnd.ContactDetails = clsContactDetails;
					clsContactCreditWnd.CreditCardStatus = CreditCardStatus.New;
                    clsContactCreditWnd.TerminalDetails = mclsTerminalDetails;
					clsContactCreditWnd.ShowDialog(this);
					result = clsContactCreditWnd.Result;
					clsContactDetails = clsContactCreditWnd.ContactDetails;
					clsContactCreditWnd.Close();
					clsContactCreditWnd.Dispose();

					if (result == DialogResult.OK)
					{
                        Data.Products clsProducts = new Data.Products(mConnection, mTransaction);
                        mConnection = clsProducts.Connection; mTransaction = clsProducts.Transaction;

                        string strProductBarcode = Data.Products.DEFAULT_CREDIT_CARD_MEMBERSHIP_FEE_BARCODE;
                        //override if with Guarantor
                        if (clsCardTypeDetails.WithGuarantor)
                            strProductBarcode = Data.Products.DEFAULT_SUPER_CARD_MEMBERSHIP_FEE_BARCODE;

                        if (clsProducts.Details(strProductBarcode).ProductID == 0)
                        {
                            if (!clsCardTypeDetails.WithGuarantor)
                                clsProducts.CREATE_CREDIT_CARD_MEMBERSHIP_FEE_BARCODE_PRODUCT();
                            else
                                clsProducts.CREATE_SUPER_CARD_MEMBERSHIP_FEE_BARCODE_PRODUCT();

                            Methods.InsertAuditLog(mclsTerminalDetails, "System Administrator", AccessTypes.RewardCardChange, strProductBarcode + " product has been created coz it's not configured");
                        }
                        clsProducts.CommitAndDispose();

						MessageBox.Show("Credit Card No: " + clsContactDetails.CreditDetails.CreditCardNo + " was issued to " + clsContactDetails.ContactName + "." +
										Environment.NewLine + "Please collect the payment then close the transaction.", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Information);

						clsEvent.AddEventLn("Done!", true);
						clsEvent.AddEventLn("Credit Card No: " + clsContactDetails.CreditDetails.CreditCardNo + " was issued to " + clsContactDetails.ContactName + ".", true);

                        LocalDB clsLocalDB = new LocalDB(mConnection, mTransaction);
                        mConnection = clsLocalDB.Connection; mTransaction = clsLocalDB.Transaction;

                        clsEvent.AddEvent("[" + lblCashier.Text + "] Creating " + strProductBarcode + "transaction for customer: ");
						LoadContact(AceSoft.RetailPlus.Data.ContactGroupCategory.CUSTOMER, clsContactDetails);
						if (!this.CreateTransaction()) return;

                        txtBarCode.Text = strProductBarcode;
						ReadBarCode();
						int iRow = dgItems.CurrentRowIndex;

						txtBarCode.Text = "";
						CloseTransaction();

                        clsLocalDB.CommitAndDispose();
					}
					else { clsEvent.AddEventLn("Cancelled!"); }
				}
				catch (Exception ex)
				{ 
                    InsertErrorLogToFile(ex, "ERROR!!! Issuing internal credit-card."); 
                }
				Cursor.Current = Cursors.Default;
			}

		}
示例#18
0
        private bool SuspendTransaction(bool ShowNotificationWindow = true)
		{
			bool boRetValue = false;

			if (!mboIsInTransaction)
			{
				MessageBox.Show("Sorry you cannot suspend an empty transaction.", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Warning);
				return boRetValue;
			}
            //if (mboIsRefund)
            //{
            //    MessageBox.Show("Sorry you cannot suspend a REFUND transaction.", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            //    return boRetValue;
            //}

			DialogResult loginresult = GetWriteAccessAndLogin(mclsSalesTransactionDetails.CashierID, AccessTypes.SuspendTransaction);

			if (loginresult == DialogResult.OK)
			{
                if (mclsSalesTransactionDetails.TransactionStatus == TransactionStatus.Closed)
                {
                    this.LoadOptions();
                    boRetValue = true;
                    return boRetValue;
                }
                        
				if (mclsSalesTransactionDetails.CustomerID == Constants.C_RETAILPLUS_CUSTOMERID)
				{
					try
					{
						clsEvent.AddEvent("[" + lblCashier.Text + "] Suspending transaction no. " + lblTransNo.Text);

                        Data.ContactDetails details = new Data.ContactDetails();
                        DialogResult addresult = System.Windows.Forms.DialogResult.Cancel;

                        switch (mclsSysConfigDetails.ContactAddWndType)
                        {
                            case ContactAddWndType.ContactAddWnd:
                            case ContactAddWndType.ContactAddNoLTOWnd:
                                ContactAddWnd clsContactAddWnd = new ContactAddWnd();
                                clsContactAddWnd.Caption = "Suspend Transaction: Please Enter Customer Name";
                                clsContactAddWnd.ContactDetails = details;
                                clsContactAddWnd.TerminalDetails = mclsTerminalDetails;
                                clsContactAddWnd.SysConfigDetails = mclsSysConfigDetails;
                                clsContactAddWnd.ShowDialog(this);
                                addresult = clsContactAddWnd.Result;
                                details = clsContactAddWnd.ContactDetails;
                                clsContactAddWnd.Close();
                                clsContactAddWnd.Dispose();
                                break;
                            case ContactAddWndType.ContactAddHCareWnd:
                                ContactAddHCareWnd clsContactAddHCareWnd = new ContactAddHCareWnd();
                                clsContactAddHCareWnd.Caption = "Suspend Transaction: Please Enter Customer Name";
                                clsContactAddHCareWnd.ContactDetails = details;
                                clsContactAddHCareWnd.TerminalDetails = mclsTerminalDetails;
                                clsContactAddHCareWnd.CashierID = mclsSalesTransactionDetails.CashierID;
                                clsContactAddHCareWnd.ShowDialog(this);
                                addresult = clsContactAddHCareWnd.Result;
                                details = clsContactAddHCareWnd.ContactDetails;
                                clsContactAddHCareWnd.Close();
                                clsContactAddHCareWnd.Dispose();
                                break;
                            default:
                                ContactAddDetWnd clsContactAddDetWnd = new ContactAddDetWnd();
                                clsContactAddDetWnd.Caption = "Suspend Transaction: Please Enter Customer Name";
                                clsContactAddDetWnd.ContactDetails = details;
                                clsContactAddDetWnd.TerminalDetails = mclsTerminalDetails;
                                clsContactAddDetWnd.ShowDialog(this);
                                addresult = clsContactAddDetWnd.Result;
                                details = clsContactAddDetWnd.ContactDetails;
                                clsContactAddDetWnd.Close();
                                clsContactAddDetWnd.Dispose();
                                break;
                        }
                        
						if (addresult == DialogResult.OK)
						{
                            Cursor.Current = Cursors.WaitCursor;

                            LoadContact(Data.ContactGroupCategory.CUSTOMER, details);

							lblCustomer.Text = details.ContactName;
							lblCustomer.Tag = details.ContactID.ToString();

							Data.SalesTransactions clsSalesTransactions = new Data.SalesTransactions(mConnection, mTransaction);
                            mConnection = clsSalesTransactions.Connection; mTransaction = clsSalesTransactions.Transaction;

                            clsSalesTransactions.Suspend(mclsSalesTransactionDetails.TransactionID, mclsSalesTransactionDetails.GrossSales, mclsSalesTransactionDetails.SubTotal, mclsSalesTransactionDetails.NetSales, details);

                            // Sep 24, 2014 : update back the LastCheckInDate to min date
                            Data.Contacts clsContact = new Data.Contacts(mConnection, mTransaction);
                            mConnection = clsContact.Connection; mTransaction = clsContact.Transaction;

                            clsContact.UpdateLastCheckInDate(mclsSalesTransactionDetails.CustomerID, mclsSalesTransactionDetails.TransactionDate);

							InsertAuditLog(AccessTypes.SuspendTransaction, "Suspend transaction #: " + lblTransNo.Text + " @ Branch: " + mclsTerminalDetails.BranchDetails.BranchCode);

							if (mclsTerminalDetails.AutoPrint == PrintingPreference.Auto)
								PrintReportFooterSection(true, TransactionStatus.Suspended, mclsSalesTransactionDetails.ItemSold, mclsSalesTransactionDetails.QuantitySold, mclsSalesTransactionDetails.SubTotal, mclsSalesTransactionDetails.Discount, mclsSalesTransactionDetails.Charge, 0, 0, 0, 0, 0, 0, 0, 0, 0, null, null, null, null);

                            clsSalesTransactions.CommitAndDispose();
							clsEvent.AddEventLn("Done!", true);

                            // Added Jun 30, 2013
                            if (mclsTerminalDetails.IsParkingTerminal)
                            {
                                if (MessageBox.Show("Would you like to print the Parking Ticket?", "Print Parking Ticket", MessageBoxButtons.YesNo,  MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == System.Windows.Forms.DialogResult.Yes)
                                    PrintParkingTicket();
                            }

                            this.LoadOptions();

							MessageBox.Show("Transaction has been SUSPENDED. Press OK button to continue...", "RetailPlus", MessageBoxButtons.OK);

							boRetValue = true;

                            Cursor.Current = Cursors.Default;
						}
						else { clsEvent.AddEventLn("Cancelled!"); }
					}
					catch (Exception ex)
					{ 
                        InsertErrorLogToFile(ex, "ERROR!!! Suspending transaction."); 
                    }
				}
				else
				{
					try
					{
                        
                        clsEvent.AddEvent("[" + lblCashier.Text + "] Suspending transaction no. " + lblTransNo.Text);

                        Data.SalesTransactions clsSalesTransactions = new Data.SalesTransactions(mConnection, mTransaction);
                        mConnection = clsSalesTransactions.Connection; mTransaction = clsSalesTransactions.Transaction;

                        clsSalesTransactions.Suspend(mclsSalesTransactionDetails.TransactionID, mclsSalesTransactionDetails.GrossSales, mclsSalesTransactionDetails.SubTotal, mclsSalesTransactionDetails.NetSales);

                        InsertAuditLog(AccessTypes.SuspendTransaction, "Suspend transaction #: " + lblTransNo.Text + " @ Branch: " + mclsTerminalDetails.BranchDetails.BranchCode);

                        if (mclsTerminalDetails.AutoPrint == PrintingPreference.Auto)
                            PrintReportFooterSection(true, TransactionStatus.Suspended, mclsSalesTransactionDetails.ItemSold, mclsSalesTransactionDetails.QuantitySold, mclsSalesTransactionDetails.SubTotal, mclsSalesTransactionDetails.Discount, mclsSalesTransactionDetails.Charge, 0, 0, 0, 0, 0, 0, 0, 0, 0, null, null, null, null);

                        clsSalesTransactions.CommitAndDispose();
                        clsEvent.AddEventLn("Done!", true);

                        // Added Jun 30, 2013
                        if (mclsTerminalDetails.IsParkingTerminal)
                        {
                            if (MessageBox.Show("Would you like to print the Parking Ticket?", "Print Parking Ticket", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == System.Windows.Forms.DialogResult.Yes)
                                PrintParkingTicket();
                        }

                        this.LoadOptions();

                        MessageBox.Show("Transaction has been SUSPENDED. Press OK button to continue...", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        boRetValue = true;
                        
					}
					catch (Exception ex)
					{ 
                        InsertErrorLogToFile(ex, "ERROR!!! Suspending transaction."); 
                    }
				}
			}
			return boRetValue;
		}
示例#19
0
        private void UpdateContact()
        {
            try {
                
                DialogResult loginresult = GetWriteAccessAndLogin(mclsSalesTransactionDetails.CashierID, AccessTypes.Contacts);
                if (loginresult == DialogResult.OK)
                {
                    loginresult = System.Windows.Forms.DialogResult.Cancel;
                    Data.ContactDetails clsContactDetails = new Data.ContactDetails(); 
                    if (mclsSalesTransactionDetails.CustomerID != 0 && mclsSalesTransactionDetails.CustomerID != Constants.C_RETAILPLUS_CUSTOMERID)
                    {
                        Data.Contacts clsContact = new Data.Contacts(mConnection, mTransaction);
                        mConnection = clsContact.Connection; mTransaction = clsContact.Transaction;
                        clsContactDetails = clsContact.Details(mclsSalesTransactionDetails.CustomerID);
                        clsContact.CommitAndDispose();
                        loginresult = System.Windows.Forms.DialogResult.OK;
                    }
                    else
                    {
                        ContactSelectWnd clsContactWnd = new ContactSelectWnd();
                        clsContactWnd.EnableContactAddUpdate = GetWriteAccess(mclsSalesTransactionDetails.CashierID, AccessTypes.Contacts) == System.Windows.Forms.DialogResult.OK;
                        clsContactWnd.SysConfigDetails = mclsSysConfigDetails;
                        clsContactWnd.TerminalDetails = mclsTerminalDetails;
                        clsContactWnd.ContactGroupCategory = Data.ContactGroupCategory.CUSTOMER;
                        clsContactWnd.ShowDialog(this);
                        clsContactDetails = clsContactWnd.Details;
                        loginresult = clsContactWnd.Result;
                        clsContactWnd.Close();
                        clsContactWnd.Dispose();
                    }

                    if (loginresult == System.Windows.Forms.DialogResult.OK)
                    {
                        DialogResult addresult = System.Windows.Forms.DialogResult.Cancel;

                        switch (mclsSysConfigDetails.ContactAddWndType)
                        {
                            case ContactAddWndType.ContactAddWnd:
                            case ContactAddWndType.ContactAddNoLTOWnd:
                                ContactAddWnd clsContactAddWnd = new ContactAddWnd();
                                clsContactAddWnd.Caption = "Update Customer [" + mclsContactDetails.ContactName + "]";
                                clsContactAddWnd.ContactDetails = clsContactDetails;
                                clsContactAddWnd.TerminalDetails = mclsTerminalDetails;
                                clsContactAddWnd.SysConfigDetails = mclsSysConfigDetails;
                                clsContactAddWnd.ShowDialog(this);
                                addresult = clsContactAddWnd.Result;
                                clsContactDetails = clsContactAddWnd.ContactDetails;
                                clsContactAddWnd.Close();
                                clsContactAddWnd.Dispose();
                                break;
                            case ContactAddWndType.ContactAddHCareWnd:
                                ContactAddHCareWnd clsContactAddHCareWnd = new ContactAddHCareWnd();
                                clsContactAddHCareWnd.Caption = "Update Customer [" + mclsContactDetails.ContactName + "]";
                                clsContactAddHCareWnd.ContactDetails = clsContactDetails;
                                clsContactAddHCareWnd.TerminalDetails = mclsTerminalDetails;
                                clsContactAddHCareWnd.ShowDialog(this);
                                addresult = clsContactAddHCareWnd.Result;
                                clsContactDetails = clsContactAddHCareWnd.ContactDetails;
                                clsContactAddHCareWnd.Close();
                                clsContactAddHCareWnd.Dispose();
                                break;
                            default:
                                ContactAddDetWnd clsContactAddDetWnd = new ContactAddDetWnd();
                                clsContactAddDetWnd.Caption = "Update Customer [" + mclsContactDetails.ContactName + "]";
                                clsContactAddDetWnd.ContactDetails = clsContactDetails;
                                clsContactAddDetWnd.TerminalDetails = mclsTerminalDetails;
                                clsContactAddDetWnd.ShowDialog(this);
                                addresult = clsContactAddDetWnd.Result;
                                clsContactDetails = clsContactAddDetWnd.ContactDetails;
                                clsContactAddDetWnd.Close();
                                clsContactAddDetWnd.Dispose();
                                break;
                        }
                        if (addresult == DialogResult.OK)
                        {
                            if (mboIsInTransaction)
                            {
                                LoadContact(Data.ContactGroupCategory.CUSTOMER, clsContactDetails);
                            }
                            MessageBox.Show("Customer has been updated and the details has been reloaded for this transaction.", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                    }
                }
                
            }
            catch { }
        }
示例#20
0
		private void cmdTable_Click(object sender, EventArgs e)
		{
			try
			{
				ProductButton cmdTable = (ProductButton)sender;

				Data.Contacts clsContact = new Contacts();
				mDetails = clsContact.Details(long.Parse(cmdTable.Tag.ToString()));

                Data.SalesTransactions clsSalesTransactions = new Data.SalesTransactions(clsContact.Connection, clsContact.Transaction);
                string stTransactionNo = clsSalesTransactions.getSuspendedTransactionNo(mDetails.ContactID, mclsTerminalDetails.TerminalNo, mclsTerminalDetails.BranchID);
                Data.SalesTransactionDetails clsSalesTransactionDetails = new SalesTransactionDetails();
                if (!string.IsNullOrEmpty(stTransactionNo))
                {
                    clsSalesTransactionDetails = clsSalesTransactions.Details(stTransactionNo, mclsTerminalDetails.TerminalNo, mclsTerminalDetails.BranchID);
                }
                clsContact.CommitAndDispose();

                if (!string.IsNullOrEmpty(stTransactionNo) && clsSalesTransactionDetails.TransactionStatus == TransactionStatus.SuspendedOpen)
                {
                    if (MessageBox.Show("This transaction is already open in another terminal. Please suspend in the other terminal first before opening." + Environment.NewLine + "Would you like to force open this transaction?", "RetailPlus", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.No)
                    {
                        //LoadContactData(System.Data.SqlClient.SortOrder.Ascending);
                        return;
                    }
                    else
                    {
                        DialogResult resResumeSuspendedOpenTransaction = GetWriteAccessAndLogin(CashierID, AccessTypes.ResumeSuspendedOpenTransaction);

                        if (resResumeSuspendedOpenTransaction != System.Windows.Forms.DialogResult.OK)
                        {
                            //LoadContactData(System.Data.SqlClient.SortOrder.Ascending);
                            return;
                        }
                    }
                }
				dialog = DialogResult.OK;
				this.Hide();
			}
			catch { }
		}
示例#21
0
        private bool SaveRecord()
        {
            Data.ContactDetails clsDetails = new Data.ContactDetails();
            clsDetails = mContactDetails;

            clsDetails.ContactCode = txtCustomerName.Text;
            clsDetails.ContactName = txtCustomerName.Text;
            clsDetails.Address = txtAddress.Text;
            clsDetails.BusinessName = txtBusinessName.Text;
            clsDetails.TelephoneNo = txtTelNo.Text;

            // Jul 22, 2014
            clsDetails.Debit = mContactDetails.Debit;
            clsDetails.Credit = mContactDetails.Credit;
            clsDetails.IsCreditAllowed = chkIsCreditAllowed.Checked;
            clsDetails.CreditLimit = decimal.Parse(txtCreditLimit.Text);
            clsDetails.Terms = int.Parse(txtTerms.Text);
            clsDetails.ModeOfTerms = (ModeOfTerms)Enum.Parse(typeof(ModeOfTerms), cboTerms.SelectedItem.ToString());

            Data.Contacts clsContact = new Data.Contacts();
            if (mContactDetails.ContactID == 0)
            {
                if (mstCaption == "Please enter customer name for deposit.")
                { clsDetails.Remarks = Data.Contacts.DEFAULT_REMARKS_FOR_ADDED_FROM_DEPOSIT; }
                else if (mstCaption == "Quickly add new customer")
                { clsDetails.Remarks = Data.Contacts.DEFAULT_REMARKS_FOR_QUICKLY_ADDED_FROM_FE; }
                else if (mContactDetails.ContactID == 0) // means not edit
                { clsDetails.Remarks = Data.Contacts.DEFAULT_REMARKS_FOR_ADDED_FROM_CLIENT; }

                clsDetails.ContactGroupID = Constants.CONTACT_GROUP_CUSTOMER;
                clsDetails.PositionID = Constants.C_RETAILPLUS_AGENT_POSITIONID;
                clsDetails.DepartmentID = Constants.C_RETAILPLUS_AGENT_DEPARTMENTID;
                clsDetails.ContactID = clsContact.Insert(clsDetails);
            }
            else
            {
                clsDetails.ContactCode = mContactDetails.ContactCode;
                clsDetails.ContactGroupID = mContactDetails.ContactGroupID;
                clsDetails.ContactGroupName = mContactDetails.ContactGroupName;
                clsContact.Update(clsDetails);
            }
            clsContact.CommitAndDispose();

            mContactDetails = clsDetails;

            return true;
        }
示例#22
0
        private void txtCardNo_TextChanged(object sender, EventArgs e)
        {
            mclsCreditorDetails = new Data.ContactDetails();
            if (!string.IsNullOrEmpty(txtCardNo.Text)
                && txtScan.Text.Length >= 12
                && txtScan.Text != mclsCreditorDetails.CreditDetails.CreditCardNo)
            {
                Data.Contacts clsContacts = new Data.Contacts();
                mclsCreditorDetails = clsContacts.DetailsByCreditCardNo(txtCardNo.Text);

                //if (mclsCreditorDetails.ContactID == 0)
                //{
                //    //mContactDetails = clsContacts.DetailsByCreditCardNo(txtScan.Text.Remove(txtScan.Text.Length - 1));

                //    if (mclsCreditorDetails.ContactID == 0 && txtScan.Text.Length == 7) mclsCreditorDetails = clsContacts.DetailsByCreditCardNo("888880" + txtScan.Text);
                //    if (mclsCreditorDetails.ContactID == 0 && txtScan.Text.Length == 7) mclsCreditorDetails = clsContacts.DetailsByCreditCardNo("800000" + txtScan.Text);
                //    if (mclsCreditorDetails.ContactID == 0 && txtScan.Text.Length == 9) mclsCreditorDetails = clsContacts.DetailsByCreditCardNo(BarcodeHelper.GroupCreditCard_Country_Code + BarcodeHelper.GroupCreditCard_ManufacturerCode + txtScan.Text);
                //    if (mclsCreditorDetails.ContactID == 0 && txtScan.Text.Length == 9) mclsCreditorDetails = clsContacts.DetailsByCreditCardNo(BarcodeHelper.CreditCard_Country_Code + BarcodeHelper.CreditCard_ManufacturerCode + txtScan.Text);
                //}
                clsContacts.CommitAndDispose();
            }

            //this means that this uses an internal credit card
            setCreditor();

            if (mclsCreditorDetails.ContactID != 0)
                setCreditCardChargeAmount(); 
            else
                unsetCreditCardCharge();
        }
示例#23
0
        private bool setCreditor()
        {
            if (string.IsNullOrEmpty(txtCardNo.Text))
            {
                mclsCreditorDetails = new Data.ContactDetails();
            }
            if (!string.IsNullOrEmpty(txtCardNo.Text))
            {
                string strContactCardNo = txtCardNo.Text;

                Data.Contacts clsContacts = new Data.Contacts();
                mclsCreditorDetails = clsContacts.DetailsByCreditCardNo(strContactCardNo);

                if (mclsCreditorDetails.ContactID == 0)
                {
                    strContactCardNo = strContactCardNo.Remove(strContactCardNo.Length - 1);
                    mclsCreditorDetails = clsContacts.DetailsByCreditCardNo(strContactCardNo);
                }
                clsContacts.CommitAndDispose();

                if(mclsCreditorDetails.ContactID != 0)
                {
                    cboCardType.SelectedText = mclsCreditorDetails.CreditDetails.CardTypeDetails.CardTypeName;
                    cboCardType.Text = mclsCreditorDetails.CreditDetails.CardTypeDetails.CardTypeName;

                    cboCardType_SelectedIndexChanged(null, null);

                    txtCardHolder.Text = mclsCreditorDetails.ContactName;
                    if (mclsCreditorDetails.CreditDetails.ExpiryDate == Constants.C_DATE_MIN_VALUE)
                        txtValidityDates.Text = "";
                    else
                        txtValidityDates.Text = mclsCreditorDetails.CreditDetails.ExpiryDate.ToString("MMyy");
                }
            }
            return true;
        }
示例#24
0
		private void ContactAdd()
		{
            if (!EnableContactAddUpdate) return;

            Data.ContactDetails details = new Data.ContactDetails();
            DialogResult addresult = System.Windows.Forms.DialogResult.Cancel;

            switch (SysConfigDetails.ContactAddWndType)
            {
                case ContactAddWndType.ContactAddWnd:
                case ContactAddWndType.ContactAddNoLTOWnd:
                    ContactAddWnd clsContactAddWnd = new ContactAddWnd();
                    clsContactAddWnd.Caption = "Quickly add new customer.";
                    clsContactAddWnd.ContactDetails = details;
                    clsContactAddWnd.TerminalDetails = TerminalDetails;
                    clsContactAddWnd.SysConfigDetails = SysConfigDetails;
                    clsContactAddWnd.ShowDialog(this);
                    addresult = clsContactAddWnd.Result;
                    details = clsContactAddWnd.ContactDetails;
                    clsContactAddWnd.Close();
                    clsContactAddWnd.Dispose();
                    break;
                case ContactAddWndType.ContactAddHCareWnd:
                    ContactAddHCareWnd clsContactAddHCareWnd = new ContactAddHCareWnd();
                    clsContactAddHCareWnd.Caption = "Quickly add new customer.";
                    clsContactAddHCareWnd.ContactDetails = details;
                    clsContactAddHCareWnd.TerminalDetails = TerminalDetails;
                    clsContactAddHCareWnd.ShowDialog(this);
                    addresult = clsContactAddHCareWnd.Result;
                    details = clsContactAddHCareWnd.ContactDetails;
                    clsContactAddHCareWnd.Close();
                    clsContactAddHCareWnd.Dispose();
                    break;
                default:
                    ContactAddDetWnd clsContactAddDetWnd = new ContactAddDetWnd();
                    clsContactAddDetWnd.Caption = "Quickly add new customer.";
                    clsContactAddDetWnd.ContactDetails = details;
                    clsContactAddDetWnd.TerminalDetails = TerminalDetails;
                    clsContactAddDetWnd.ShowDialog(this);
                    addresult = clsContactAddDetWnd.Result;
                    details = clsContactAddDetWnd.ContactDetails;
                    clsContactAddDetWnd.Close();
                    clsContactAddDetWnd.Dispose();
                    break;
            }

            if (addresult == DialogResult.OK)
            {
                txtSearch.Text = details.ContactCode;
                LoadContactData();
            }
		}
        private void LoadOptions()
        {
            mContactDetails = new Data.ContactDetails();
            mGuarantorDetails = new Data.ContactDetails();
            txtScan.Focus();

            txtScan.Size = new Size(726, 30);
            switch (SysConfigDetails.CreditPaymentType)
            {
                case CreditPaymentType.MPC:
                case CreditPaymentType.Normal:
                default:
                    lblF11.Visible = true; labelF11.Visible = true;
                    txtScan.Size = new Size(558, 30);
                    break;
            }
        }
示例#26
0
        private void ContactAdd()
        {
            Data.ContactDetails details = new Data.ContactDetails();

            System.Windows.Forms.DialogResult addresult = System.Windows.Forms.DialogResult.Cancel;

            switch (SysConfigDetails.ContactAddWndType)
            {
                case ContactAddWndType.ContactAddWnd:
                    ContactAddWnd clsContactAddWnd = new ContactAddWnd();
                    clsContactAddWnd.Caption = "Please enter customer name for deposit.";
                    clsContactAddWnd.ContactDetails = details;
                    clsContactAddWnd.TerminalDetails = TerminalDetails;
                    clsContactAddWnd.ShowDialog(this);
                    addresult = clsContactAddWnd.Result;
                    details = clsContactAddWnd.ContactDetails;
                    clsContactAddWnd.Close();
                    clsContactAddWnd.Dispose();
                    break;
                case ContactAddWndType.ContactAddHCareWnd:
                    ContactAddHCareWnd clsContactAddHCareWnd = new ContactAddHCareWnd();
                    clsContactAddHCareWnd.Caption = "Please enter customer name for deposit.";
                    clsContactAddHCareWnd.ContactDetails = details;
                    clsContactAddHCareWnd.TerminalDetails = TerminalDetails;
                    clsContactAddHCareWnd.ShowDialog(this);
                    addresult = clsContactAddHCareWnd.Result;
                    details = clsContactAddHCareWnd.ContactDetails;
                    clsContactAddHCareWnd.Close();
                    clsContactAddHCareWnd.Dispose();
                    break;
                default:
                    ContactAddDetWnd clsContactAddDetWnd = new ContactAddDetWnd();
                    clsContactAddDetWnd.Caption = "Please enter customer name for deposit.";
                    clsContactAddDetWnd.ContactDetails = details;
                    clsContactAddDetWnd.TerminalDetails = TerminalDetails;
                    clsContactAddDetWnd.ShowDialog(this);
                    addresult = clsContactAddDetWnd.Result;
                    details = clsContactAddDetWnd.ContactDetails;
                    clsContactAddDetWnd.Close();
                    clsContactAddDetWnd.Dispose();
                    break;
            }

            if (addresult == DialogResult.OK)
            {
                txtContact.Text = details.ContactName;
                txtContact.Tag = details.ContactID.ToString();
            }
        }
示例#27
0
        /// <summary>
        /// This is to print the Internal Credit Card used for payment
        /// </summary>
        /// <param name="clsChargeSlipType"></param>
        public void PrintChargeSlip(ChargeSlipType clsChargeSlipType)
        {
            try
            {
                decimal decInternalCreditCardPayment = 0;
                Data.ContactDetails clsCreditorDetails = new Data.ContactDetails();
                Data.ContactDetails clsGuarantorDetails = new Data.ContactDetails();
                Data.CardTypeDetails clsCreditCardTypeDetails = new Data.CardTypeDetails();

                foreach (Data.CreditCardPaymentDetails clsCreditCardPaymentDetails in mclsSalesTransactionDetails.PaymentDetails.arrCreditCardPaymentDetails)
                {
                    if (clsCreditCardPaymentDetails.CardTypeDetails.CreditCardType == CreditCardTypes.Internal)
                    {
                        decInternalCreditCardPayment += clsCreditCardPaymentDetails.Amount;
                        clsCreditCardTypeDetails = clsCreditCardPaymentDetails.CardTypeDetails;
                        clsCreditorDetails = clsCreditCardPaymentDetails.CreditorDetails;

                        Data.Contacts clsContacts = new Data.Contacts(mConnection, mTransaction);
                        mConnection = clsContacts.Connection; mTransaction = clsContacts.Transaction;

                        if (clsCreditCardTypeDetails.WithGuarantor)
                        {
                            clsGuarantorDetails = new Data.Contacts(mConnection, mTransaction).Details(clsCreditorDetails.CreditDetails.GuarantorID);
                        }
                        clsContacts.CommitAndDispose();
                    }
                }

                if (decInternalCreditCardPayment != 0)
                {
                    PrintingPreference oldCONFIG_AutoPrint = mclsTerminalDetails.AutoPrint;
                    mclsTerminalDetails.AutoPrint = PrintingPreference.Normal;

                    PrintReportHeaderSection(false, DateTime.MinValue);

                    if (!string.IsNullOrEmpty(mclsSysConfigDetails.ChargeSlipHeaderLabel))
                    {
                        msbToPrint.Append(CenterString(mclsSysConfigDetails.ChargeSlipHeaderLabel, mclsTerminalDetails.MaxReceiptWidth) + Environment.NewLine);
                        msbToPrint.Append(CenterString(Constants.C_FE_NOT_VALID_AS_RECEIPT, mclsTerminalDetails.MaxReceiptWidth) + Environment.NewLine);
                    }

                    msbToPrint.Append(Environment.NewLine);
                    msbToPrint.Append(Environment.NewLine);
                    msbToPrint.Append("Trans. Date".PadRight(15) + ":" + mclsSalesTransactionDetails.TransactionDate.ToString("yyyy-MM-dd").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 16) + Environment.NewLine);
                    msbToPrint.Append("OR #".PadRight(15) + ":" + mclsSalesTransactionDetails.ORNo.PadLeft(mclsTerminalDetails.MaxReceiptWidth - 16) + Environment.NewLine);
                    
                    // print the guarantor if with guarantor
                    if (clsCreditCardTypeDetails.WithGuarantor)
                    {
                        msbToPrint.Append(CenterString(clsGuarantorDetails.ContactCode, mclsTerminalDetails.MaxReceiptWidth) + Environment.NewLine);
                        msbToPrint.Append("-".PadLeft(mclsTerminalDetails.MaxReceiptWidth, '-') + Environment.NewLine);
                        msbToPrint.Append(CenterString("Guarantor", mclsTerminalDetails.MaxReceiptWidth) + Environment.NewLine);
                    }
                    msbToPrint.Append(Environment.NewLine);

                    // print the charge slip header
                    if (string.IsNullOrEmpty(clsCreditCardTypeDetails.CardTypeName))
                    { msbToPrint.Append(CenterString("CHARGE SLIP", mclsTerminalDetails.MaxReceiptWidth) + Environment.NewLine); }
                    else { msbToPrint.Append(CenterString(clsCreditCardTypeDetails.CardTypeName + " CHARGE SLIP", mclsTerminalDetails.MaxReceiptWidth) + Environment.NewLine); }

                    
                    // print the amount and agreement
                    msbToPrint.Append(Environment.NewLine);
                    msbToPrint.Append("Amount of Purchase".PadRight(18) + ":" + decInternalCreditCardPayment.ToString("#,##0.#0").PadLeft(mclsTerminalDetails.MaxReceiptWidth - 19) + Environment.NewLine);
                    msbToPrint.Append(Environment.NewLine);
                    if (mclsTerminalDetails.IncludeCreditChargeAgreement)
                    {
                        msbToPrint.Append("I hereby agree  to pay the total  amount" + Environment.NewLine);
                        msbToPrint.Append("stated herein including any charges  due" + Environment.NewLine);
                        msbToPrint.Append("thereon  subject   to    the   pertinent" + Environment.NewLine);
                        msbToPrint.Append("contract   governing  the use of    this" + Environment.NewLine);
                        msbToPrint.Append("Credit Card." + Environment.NewLine);
                        msbToPrint.Append(Environment.NewLine);
                        msbToPrint.Append(Environment.NewLine);
                    }
                    msbToPrint.Append("-".PadLeft(mclsTerminalDetails.MaxReceiptWidth, '-') + Environment.NewLine);
                    msbToPrint.Append(CenterString(mclsSalesTransactionDetails.CustomerName, mclsTerminalDetails.MaxReceiptWidth) + Environment.NewLine);
                    msbToPrint.Append(Environment.NewLine);
                    msbToPrint.Append(Environment.NewLine);
                    msbToPrint.Append("-".PadLeft(mclsTerminalDetails.MaxReceiptWidth, '-') + Environment.NewLine);
                    msbToPrint.Append(CenterString(mclsSalesTransactionDetails.CashierName, mclsTerminalDetails.MaxReceiptWidth) + Environment.NewLine);
                    msbToPrint.Append(CenterString("Cashier", mclsTerminalDetails.MaxReceiptWidth) + Environment.NewLine);
                    msbToPrint.Append(Environment.NewLine);
                    switch (clsChargeSlipType)
                    {
                        case ChargeSlipType.Customer:
                            msbToPrint.Append(CenterString("Customer's Copy", mclsTerminalDetails.MaxReceiptWidth) + Environment.NewLine);
                            break;
                        case ChargeSlipType.Original:
                            msbToPrint.Append(CenterString("Original Copy", mclsTerminalDetails.MaxReceiptWidth) + Environment.NewLine);
                            break;
                        case ChargeSlipType.Guarantor:
                            msbToPrint.Append(CenterString("Guarantor's Copy", mclsTerminalDetails.MaxReceiptWidth) + Environment.NewLine);
                            break;
                    }

                    msbToPrint.Append(CenterString("Check Ctr:" + Int64.Parse(mclsSalesTransactionDetails.TransactionNo).ToString(), mclsTerminalDetails.MaxReceiptWidth) + Environment.NewLine);
                    PrintPageAndReportFooterSection(false, DateTime.MinValue);

                    mclsTerminalDetails.AutoPrint = oldCONFIG_AutoPrint;

                    InsertAuditLog(AccessTypes.PrintTransactionHeader, "Print Charge Slip: " + clsChargeSlipType.ToString("G") + " TerminalNo=" + mclsTerminalDetails.TerminalNo + " @ Branch: " + mclsTerminalDetails.BranchDetails.BranchCode);
                }
            }
            catch (Exception ex)
            {
                InsertErrorLogToFile(ex, "ERROR!!! Printing Charge Slip: " + clsChargeSlipType.ToString("G"));
            }
            Cursor.Current = Cursors.Default;
        }
示例#28
0
		private void ShowCreditCardPaymentWindow(string sender = "f3")
		{
            CreditCardPaymentWnd clsCreditCardPaymentWnd = new CreditCardPaymentWnd();
            clsCreditCardPaymentWnd.IsCreditChargeExcluded = mboIsCreditChargeExcluded;
            clsCreditCardPaymentWnd.TerminalDetails = TerminalDetails;
            clsCreditCardPaymentWnd.SysConfigDetails = SysConfigDetails;
            clsCreditCardPaymentWnd.OfflineProduct = OfflineProductDesc;
            clsCreditCardPaymentWnd.SalesTransactionDetails = mclsSalesTransactionDetails;
            if (sender == "f4") clsCreditCardPaymentWnd.CreditorDetails = mclsCustomerDetails;
            clsCreditCardPaymentWnd.arrCreditCardPaymentDetails = marrCreditCardPaymentDetails;
            clsCreditCardPaymentWnd.IsRefund = mboIsRefund;
            clsCreditCardPaymentWnd.BalanceAmount = Convert.ToDecimal(lblBalance.Text);
            clsCreditCardPaymentWnd.ShowDialog(this);
            DialogResult result = clsCreditCardPaymentWnd.Result;
            Data.CreditCardPaymentDetails creditcardDetails = clsCreditCardPaymentWnd.Details;
            mclsCreditorDetails = clsCreditCardPaymentWnd.CreditorDetails;
            clsCreditCardPaymentWnd.Close();
            clsCreditCardPaymentWnd.Dispose();

			if (result == DialogResult.OK)
			{
                // set the credit card charges for inhouse credit cards
                if (creditcardDetails.AdditionalCharge != 0)
                {
                    lblCharge.Text = (decimal.Parse(lblCharge.Text) + creditcardDetails.AdditionalCharge).ToString("#,##0.#0");
                    mclsSalesTransactionDetails.CreditChargeAmount = creditcardDetails.AdditionalCharge;
                }

				lblAmountPaid.Text = Convert.ToDecimal(Convert.ToDecimal(lblAmountPaid.Text) + creditcardDetails.Amount).ToString("#,##0.#0");
				marrCreditCardPaymentDetails.Add(creditcardDetails);
				ComputePayments();
				lblCreditCard.Tag = Convert.ToDecimal(Convert.ToDecimal(lblCreditCard.Tag) + creditcardDetails.Amount - Convert.ToDecimal(lblChange.Text)).ToString("#,##0.#0");

				if (mPaymentType == PaymentTypes.NotYetAssigned)
					mPaymentType = PaymentTypes.CreditCard;
				else
					mPaymentType = PaymentTypes.Combination;
			}
		}
示例#29
0
        private bool SaveRecord()
        {
            if (MessageBox.Show("Please validate the customer information details before proceeding. Are you sure you want to continue?", "RetailPlus ™", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.No)
            {
                return(false);
            }
            else
            {
                Data.ContactDetails clsDetails = new Data.ContactDetails();
                clsDetails = mContactDetails;

                clsDetails.ContactCode    = txtContactCode.Text;
                clsDetails.ContactName    = txtContactName.Text;
                clsDetails.ContactGroupID = Convert.ToInt32(Constants.CONTACT_GROUP_CUSTOMER);
                clsDetails.ModeOfTerms    = ModeOfTerms.Days;
                clsDetails.Terms          = Convert.ToInt32("0");
                clsDetails.TINNo          = txtTelephoneNo.Tag == null ? "" : txtTelephoneNo.Tag.ToString();
                clsDetails.LTONo          = txtRemarks.Tag == null ? "" : txtRemarks.Tag.ToString();
                clsDetails.Address        = txtAddress.Text;
                clsDetails.BusinessName   = txtBusinessName.Text;
                clsDetails.TelephoneNo    = txtTelephoneNo.Text;
                clsDetails.Remarks        = txtRemarks.Text;
                //clsDetails.Debit = Convert.ToDecimal("0");
                //clsDetails.Credit = Convert.ToDecimal(txtCredit.Text);
                //clsDetails.IsCreditAllowed = chkIsCreditAllowed.Checked;
                //clsDetails.CreditLimit = Convert.ToDecimal(txtCreditLimit.Text);
                //clsDetails.DepartmentID = Convert.ToInt16(cboDepartment.SelectedItem.Value);
                //clsDetails.PositionID = Convert.ToInt16(cboPosition.SelectedItem.Value);

                Data.ContactAddOnDetails clsAddOnDetails = new Data.ContactAddOnDetails();
                clsAddOnDetails.ContactID  = clsDetails.ContactID;
                clsAddOnDetails.Salutation = cboSalutation.SelectedValue.ToString();
                clsAddOnDetails.FirstName  = txtFirstName.Text;
                clsAddOnDetails.MiddleName = txtMiddleName.Text;
                clsAddOnDetails.LastName   = txtLastName.Text;
                clsAddOnDetails.SpouseName = "";
                DateTime dteBirthDate = Constants.C_DATE_MIN_VALUE;
                dteBirthDate = DateTime.TryParse(txtBirthDate.Text, out dteBirthDate) ? dteBirthDate : Constants.C_DATE_MIN_VALUE;
                clsAddOnDetails.BirthDate       = dteBirthDate;
                clsAddOnDetails.SpouseBirthDate = Constants.C_DATE_MIN_VALUE;
                clsAddOnDetails.AnniversaryDate = Constants.C_DATE_MIN_VALUE;
                clsAddOnDetails.Address1        = txtAddress.Text;
                clsAddOnDetails.Address2        = string.Empty;
                clsAddOnDetails.City            = string.Empty;
                clsAddOnDetails.State           = string.Empty;
                clsAddOnDetails.ZipCode         = string.Empty;
                clsAddOnDetails.CountryID       = Constants.C_DEF_COUNTRY_ID;
                clsAddOnDetails.CountryCode     = Constants.C_DEF_COUNTRY_CODE;
                clsAddOnDetails.BusinessPhoneNo = txtTelephoneNo.Text;
                clsAddOnDetails.HomePhoneNo     = string.Empty;
                clsAddOnDetails.MobileNo        = txtMobileNo.Text;
                clsAddOnDetails.FaxNo           = string.Empty;
                clsAddOnDetails.EmailAddress    = string.Empty;

                clsDetails.AdditionalDetails = clsAddOnDetails;

                Data.Contacts clsContact = new Data.Contacts();
                if (mContactDetails.ContactID == 0)
                {
                    clsDetails.ContactGroupID = Constants.CONTACT_GROUP_CUSTOMER;
                    clsDetails.PositionID     = Constants.C_RETAILPLUS_AGENT_POSITIONID;
                    clsDetails.DepartmentID   = Constants.C_RETAILPLUS_AGENT_DEPARTMENTID;
                    clsDetails.ContactID      = clsContact.Insert(clsDetails);
                }
                else
                {
                    clsDetails.PositionID       = mContactDetails.PositionID;
                    clsDetails.DepartmentID     = mContactDetails.DepartmentID;
                    clsDetails.ContactGroupID   = mContactDetails.ContactGroupID;
                    clsDetails.ContactGroupName = mContactDetails.ContactGroupName;
                    clsContact.Update(clsDetails);
                }
                clsContact.CommitAndDispose();

                mContactDetails = clsDetails;

                return(true);
            }
        }
示例#30
0
        private bool isValuesAssigned()
        {
            decimal mdecAmount = 0;
            try
            {
                mdecAmount = Convert.ToDecimal(txtAmount.Text);
            }
            catch
            {
                txtAmount.Focus();
                MessageBox.Show("Sorry you have entered an invalid amount for credit card payment. Please type a valid credit amount.", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return false;
            }
            if (string.IsNullOrEmpty(cboCardType.Text))
            {
                cboCardType.Focus();
                MessageBox.Show("Please select a valid Card Type.", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return false;
            }
            if (txtCardNo.Text == null || txtCardNo.Text == "")
            {
                txtCardNo.Focus();
                MessageBox.Show("Please type a valid Card No.", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return false;
            }
            if (txtCardHolder.Text == null || txtCardHolder.Text == "")
            {
                txtCardHolder.Focus();
                MessageBox.Show("Please type a valid Card Holder.", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return false;
            }
            DateTime ValidityDate = DateTime.MinValue;
            if (string.IsNullOrEmpty(txtValidityDates.Text))
            {
                txtValidityDates.Focus();
                MessageBox.Show("Please type a valid Validity Date.", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return false;
            }
            else if (!string.IsNullOrEmpty(txtValidityDates.Text))
            {
                try
                {
                    string Month = txtValidityDates.Text.Substring(0, 2);
                    string Year = "20" + txtValidityDates.Text.Substring(2, 2);
                    string Day = DateTime.DaysInMonth(Convert.ToInt32(Year), Convert.ToInt32(Month)).ToString();
                    ValidityDate = new DateTime(int.Parse(Year), int.Parse(Month), int.Parse(Day));
                }
                catch
                {
                    txtValidityDates.Focus();
                    MessageBox.Show("Please type a valid Validity Date. Format must be mmyy", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return false;
                }

                if (!IsRefund) // check only if it's not refund
                {
                    if (!mboIsCreditChargeExcluded) // check only if it's not chargeexcluded or offline trx
                    {
                        if (ValidityDate < DateTime.Now)
                        {
                            txtValidityDates.Focus();
                            MessageBox.Show("Card has been expired, please ask for a valid credit card.", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            return false;
                        }
                    }
                }
            }
            // make sure that only 1 INTERNAL CREDIT CARD can be use per transaction
            if (mclsCardTypeDetails.CreditCardType == CreditCardTypes.Internal)
            {
                foreach (Data.CreditCardPaymentDetails clsCreditCardPaymentDetails in marrCreditCardPaymentDetails)
                {
                    if (clsCreditCardPaymentDetails.CardTypeDetails.CreditCardType == CreditCardTypes.Internal)
                    {
                        MessageBox.Show("Sorry an INTERNAL CREDIT CARD has only been use to pay. Please use another credit card or another mode of payment (e.g. cash).", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return false;
                    }
                }
            }

            decimal decAdditionalCreditCharge = 0;
            if (mclsCreditorDetails.ContactID != 0)
            {
                // add only the charge if the credit is chargeable
                if (panCharge.Visible) mdecAmount += decimal.Parse(txtCreditCardCharge.Text);

                decimal mdecAllowedCredit = mclsCreditorDetails.CreditLimit - mclsCreditorDetails.Credit;
                
                if (!IsRefund) // check only if it's not refund
                {
                    if (!mboIsCreditChargeExcluded) // check only if it's not chargeexcluded or offline trx
                    {
                        if (mdecAmount > mdecAllowedCredit)
                        {
                            MessageBox.Show("Amount must be less than the credit limit (" + mdecAllowedCredit.ToString("#,##0.#0") + "). Please enter a lower amount for credit payment.", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            txtAmount.Focus();
                            return false;
                        }
                        if (mdecAmount <= 0)
                        {
                            MessageBox.Show("Amount must be greater than zero. Please enter a higher amount for credit payment.", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            txtAmount.Focus();
                            return false;
                        }
                        if (!mclsCreditorDetails.CreditDetails.CreditActive)
                        {
                            MessageBox.Show("Sorry the credit card status is " + mclsCreditorDetails.CreditDetails.CreditCardStatus.ToString("G") + ". Please enter an active credit card no.", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            txtScan.Focus();
                            return false;
                        }
                        if (mclsCardTypeDetails.WithGuarantor)
                        {
                            Data.Contacts clsContacts = new Data.Contacts();
                            mclsGuarantorDetails = clsContacts.Details(mclsCreditorDetails.CreditDetails.GuarantorID);
                            clsContacts.CommitAndDispose();

                            if (!mclsGuarantorDetails.CreditDetails.CreditActive)
                            {
                                MessageBox.Show("Sorry the Guarantor's credit card status is " + mclsGuarantorDetails.CreditDetails.CreditCardStatus.ToString("G") + ". Please enter an active credit card no.", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                                txtScan.Focus();
                                return false;
                            }
                        }
                    }
                }

                if (mboIsCreditChargeExcluded) // exclude if it's an special item
                { decAdditionalCreditCharge = 0; }
                else if (mclsCardTypeDetails.ExemptInTerminalCharge) // exclude if it's an exemption
                { decAdditionalCreditCharge = 0; }
                else if (mclsCardTypeDetails.WithGuarantor && TerminalDetails.GroupChargeType.ChargeTypeID != 0)
                {
                    if (panCharge.Visible) decAdditionalCreditCharge = decimal.Parse(txtCreditCardCharge.Text);

                    //if (TerminalDetails.GroupChargeType.InPercent)
                    //    decAdditionalCreditCharge = mdecBalanceAmount * (TerminalDetails.GroupChargeType.ChargeAmount / 100);
                    //else
                    //    decAdditionalCreditCharge = mdecBalanceAmount + TerminalDetails.GroupChargeType.ChargeAmount;
                }
                else if (!mclsCardTypeDetails.WithGuarantor && TerminalDetails.PersonalChargeType.ChargeTypeID != 0)
                {
                    if (panCharge.Visible) decAdditionalCreditCharge = decimal.Parse(txtCreditCardCharge.Text);

                    //if (TerminalDetails.PersonalChargeType.InPercent)
                    //    decAdditionalCreditCharge = mdecBalanceAmount * (TerminalDetails.PersonalChargeType.ChargeAmount / 100);
                    //else
                    //    decAdditionalCreditCharge = mdecBalanceAmount + TerminalDetails.PersonalChargeType.ChargeAmount;
                }

                if (!IsRefund) // check only if it's not refund
                {
                    if (!mboIsCreditChargeExcluded) // check only if it's not chargeexcluded or offline trx
                    {
                        if (decAdditionalCreditCharge == 0)
                        {
                            if (mdecAmount > mdecBalanceAmount + decAdditionalCreditCharge)
                            {
                                txtAmount.Focus();
                                MessageBox.Show("Amount must be less than the balance amount (" + mdecBalanceAmount.ToString("#,##0.#0") + "). Please enter a lower or equal amount for credit payment.", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                                return false;
                            }
                        }
                    }
                }
            }
            if (mclsCreditorDetails.ContactID == 0 && mclsCardTypeDetails.CreditCardType == CreditCardTypes.Internal)
            {
                MessageBox.Show("Please enter a valid card no for " + cboCardType.Text + ".", "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return false;
            }

            mDetails.BranchDetails = TerminalDetails.BranchDetails;
            mDetails.TerminalNo = TerminalDetails.TerminalNo;
            mDetails.TransactionID = mclsSalesTransactionDetails.TransactionID;
            mDetails.TransactionNo = mclsSalesTransactionDetails.TransactionNo;
            mDetails.TransactionDate = mclsSalesTransactionDetails.TransactionDate;
            mDetails.CashierName = mclsSalesTransactionDetails.CashierName;

            mDetails.Amount = mdecAmount;
            mDetails.AdditionalCharge = decAdditionalCreditCharge;

            mDetails.CardTypeID = mclsCardTypeDetails.CardTypeID;
            mDetails.CardTypeCode = mclsCardTypeDetails.CardTypeCode;
            mDetails.CardTypeName = mclsCardTypeDetails.CardTypeName;
            mDetails.CardNo = txtCardNo.Text;
            mDetails.CardHolder = txtCardHolder.Text;
            
            mDetails.ValidityDates = ValidityDate.ToString("MMddyy");
            mDetails.Remarks = (OfflineProduct + " " + txtRemarks.Text).Trim();
            mDetails.CardTypeDetails = mclsCardTypeDetails;
            mDetails.CreditorDetails = mclsCreditorDetails;
            mDetails.IsRefund = IsRefund;
            mDetails.CreatedOn = mclsSalesTransactionDetails.TransactionDate;

            return true;
        }
        private void cboCardType_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (cboCardType.Text == "No available cards to issue")
                grpCardInfo.Visible = false;
            else
            {
                Data.CardType clsCardType = new Data.CardType();
                Data.CardTypeDetails clsCardTypeDetails = clsCardType.Details(cboCardType.Text);
                clsCardType.CommitAndDispose();

                if (clsCardTypeDetails.CardTypeID == 0)
                {
                    grpCardInfo.Visible = false;
                    CardTypeDetails = new Data.CardTypeDetails();
                }
                else
                {
                    grpCardInfo.Visible = true;
                    lblCardTypeCode.Text = clsCardTypeDetails.CardTypeCode;
                    lblFinanceCharge.Text = clsCardTypeDetails.CreditFinanceCharge.ToString("##0.#0");
                    lblPenaltyCharge.Text = clsCardTypeDetails.CreditLatePenaltyCharge.ToString("##0.#0");
                    lblMinimumPercentageDue.Text = clsCardTypeDetails.CreditMinimumPercentageDue.ToString("##0.#0");
                    lblMinimumAmountDue.Text = clsCardTypeDetails.CreditMinimumAmountDue.ToString("##0.#0");
                    chkWithGuarantor.Checked = clsCardTypeDetails.WithGuarantor;

                    CardTypeDetails = clsCardTypeDetails;

                    if (!clsCardTypeDetails.WithGuarantor)
                    {
                        mclsGuarantor = new Data.ContactDetails();
                    }
                    else
                    {

                    }
                }
            }
        }
示例#32
0
		private void CreditsItemizeWnd_KeyDown(object sender, KeyEventArgs e)
		{
			switch (e.KeyData)
			{
				case Keys.Escape:
                    if (grpSearch.Visible)
                    {
                        grpSearch.Visible = false;
                        dgvItems.Focus();
                        cmdEnter.Text = "Enter";
                    }
                    else
                    {
                        this.Hide();
                    }
					break;

				case Keys.Enter:
                    if (grpSearch.Visible)
                    {
                        LoadData();
                    }
					else if (Convert.ToDecimal(lblBalanceSelected.Text) > 0)
					{
                        Data.Products clsProducts = new Data.Products();
                        if (clsProducts.Details(Data.Products.DEFAULT_CREDIT_PAYMENT_BARCODE).ProductID == 0)
                        {
                            clsProducts.CREATE_CREDITPAYMENT_PRODUCT();
                            Methods.InsertAuditLog(TerminalDetails, "System Administrator", AccessTypes.EnterCreditPayment, "CREDIT PAYMENT product has been created coz it's not configured");
                        }
                        clsProducts.CommitAndDispose();
                        
                        dialog = ShowPayment();
                        if (dialog == DialogResult.OK)
                        { mKeyData = Keys.Enter; this.Hide(); }
					}
					else
						this.Hide();

					break;

                case Keys.F3:
                    CreditSalesWnd clsCreditSalesWnd = new CreditSalesWnd();
                    clsCreditSalesWnd.TerminalDetails = TerminalDetails;
                    clsCreditSalesWnd.SysConfigDetails = mclsSysConfigDetails;
                    clsCreditSalesWnd.CustomerDetails = mclsCustomerDetails;
                    clsCreditSalesWnd.ShowDialog(this);
                    clsCreditSalesWnd.Close();
                    clsCreditSalesWnd.Dispose();
                    break;

                case Keys.F4:
                    CreditPaymentsWnd clsCreditPaymentsWnd = new CreditPaymentsWnd();
                    clsCreditPaymentsWnd.TerminalDetails = TerminalDetails;
                    clsCreditPaymentsWnd.SysConfigDetails = mclsSysConfigDetails;
                    clsCreditPaymentsWnd.CustomerDetails = mclsCustomerDetails;
                    clsCreditPaymentsWnd.CashierID = CashierID;
                    clsCreditPaymentsWnd.ShowDialog(this);
                    DialogResult result = clsCreditPaymentsWnd.Result;
                    mclsCustomerDetails = clsCreditPaymentsWnd.CustomerDetails;
                    clsCreditPaymentsWnd.Close();
                    clsCreditPaymentsWnd.Dispose();

                    if (result == System.Windows.Forms.DialogResult.OK)
                    {
                        LoadData();
                    }
                    break;

                case Keys.F5:
                    if (!lblF5.Visible) return;
                    grpSearch.Visible = !grpSearch.Visible;
                    if (grpSearch.Visible)
                    {
                        txtTrxStartDate.Focus();
                        cmdEnter.Text = "Search";
                    }
                    else
                    {
                        dgvItems.Focus();
                        cmdEnter.Text = "Enter";
                    }
                    break;
                case Keys.F11:
                    if (!lblF11.Visible) return;
                    if (dgvItems.Rows.Count > 0)
                    {
                        PrintSOA();
                    }
                    break;
                case Keys.F12:
                    if (!lblF12.Visible) return;
                    TransactionNoToReprint = ""; TerminalNoToReprint = "";
                    foreach (DataGridViewRow dr in dgvItems.SelectedRows)
                    {
                        TransactionNoToReprint = dr.Cells["TransactionNo"].Value.ToString();
                        TerminalNoToReprint = dr.Cells["TerminalNo"].Value.ToString();
                        dialog = System.Windows.Forms.DialogResult.OK;
                        mKeyData = Keys.F12;
                        this.Hide();
                        break;
                    }
                    break;

			}
		}
示例#33
0
        private bool SaveRecord()
        {
            Data.ContactDetails clsDetails = new Data.ContactDetails();
            clsDetails.ContactCode = txtCustomerName.Text;
            clsDetails.ContactName = txtCustomerName.Text;
            clsDetails.ContactGroupID = Constants.CONTACT_GROUP_CUSTOMER;
            clsDetails.ModeOfTerms = 0;
            clsDetails.Terms = 0;
            clsDetails.Address = txtAddress.Text;
            clsDetails.BusinessName = txtBusinessName.Text;
            clsDetails.TelephoneNo = txtTelNo.Text;
            if (mstCaption == "Please enter customer name for deposit.")
            { clsDetails.Remarks = Data.Contacts.DEFAULT_REMARKS_FOR_ADDED_FROM_DEPOSIT; }
            else if (mstCaption == "Quickly add new customer")
            { clsDetails.Remarks = Data.Contacts.DEFAULT_REMARKS_FOR_QUICKLY_ADDED_FROM_FE; }
            else
            { clsDetails.Remarks = Data.Contacts.DEFAULT_REMARKS_FOR_ADDED_FROM_CLIENT; }
            clsDetails.Debit = 0;
            clsDetails.Credit = 0;
            clsDetails.IsCreditAllowed = true;
            clsDetails.CreditLimit = 0;
            clsDetails.PositionID = Constants.C_RETAILPLUS_AGENT_POSITIONID;
            clsDetails.DepartmentID = Constants.C_RETAILPLUS_AGENT_DEPARTMENTID;

            Data.Contacts clsContact = new Data.Contacts();
            clsDetails.ContactID = clsContact.Insert(clsDetails);
            clsContact.CommitAndDispose();

            mContactDetails = clsDetails;

            return true;
        }
示例#34
0
        private void LoadContactData(System.Data.SqlClient.SortOrder SequenceSortOrder)
        {
            try
            {
                tblLayout.Controls.Clear();
                Int64 intSequenceNoStart = 0;

                if (SequenceSortOrder == System.Data.SqlClient.SortOrder.Descending)
                {
                    try { intSequenceNoStart = long.Parse(cmdTableLeft.Tag.ToString()); }
                    catch { }
                }
                else
                {
                    try { intSequenceNoStart = long.Parse(cmdTableRight.Tag.ToString()); }
                    catch { }
                }

                // Sep 24, 2014 put an override if cmdSubGroupLeft.Tag = 0
                // always do an asceding coz its already the end.
                if (intSequenceNoStart < Constants.C_RESTOPLUS_MAX_TABLES)
                {
                    intSequenceNoStart = 0;                                                        //reset to 0 if it's 1
                }
                if (intSequenceNoStart == 0)
                {
                    SequenceSortOrder = System.Data.SqlClient.SortOrder.Ascending;
                }

                ContactColumns clsContactColumns = new ContactColumns();
                clsContactColumns.ContactCode     = true;
                clsContactColumns.LastCheckInDate = true;

                ContactColumns clsSearchColumns = new ContactColumns();

                Contacts clsContact = new Contacts();

                System.Data.DataTable dtContact;

                if (ContactGroupCategory == Data.ContactGroupCategory.TABLES)
                {
                    dtContact = clsContact.Tables(clsContactColumns, intSequenceNoStart, SequenceSortOrder, clsSearchColumns, string.Empty, SequenceSortOrder == System.Data.SqlClient.SortOrder.Descending ? Constants.C_RESTOPLUS_MAX_TABLES : Constants.C_RESTOPLUS_MAX_TABLES + 1, false, "SequenceNo", SequenceSortOrder);
                }
                else
                {
                    dtContact = clsContact.Customers(clsContactColumns, intSequenceNoStart, SequenceSortOrder, clsSearchColumns, string.Empty, SequenceSortOrder == System.Data.SqlClient.SortOrder.Descending ? Constants.C_RESTOPLUS_MAX_TABLES : Constants.C_RESTOPLUS_MAX_TABLES + 1, false, "SequenceNo", SequenceSortOrder);
                }

                // re-order the products by sequence no
                if (dtContact.Rows.Count > 0)
                {
                    System.Data.DataView dv = dtContact.DefaultView;
                    dv.Sort   = "ContactCode";
                    dtContact = dv.ToTable();
                }

                int iRow = 0;
                int iCol = 0;
                int iCtr = 1;
                Data.SalesTransactions       clsSalesTransactions       = new Data.SalesTransactions(clsContact.Connection, clsContact.Transaction);
                Data.SalesTransactionDetails clsSalesTransactionDetails = new Data.SalesTransactionDetails();

                Data.MergeTable        clsMergeTable        = new Data.MergeTable(clsContact.Connection, clsContact.Transaction);
                Data.MergeTableDetails clsMergeTableDetails = new Data.MergeTableDetails();

                if (dtContact.Rows.Count == 0)
                {
                    cmdTableLeft.Tag  = "0".ToString();                    // reset the sequenceno to 0 if no record
                    cmdTableRight.Tag = "0".ToString();                    // reset the sequenceno to 0 if no record
                }

                foreach (System.Data.DataRow dr in dtContact.Rows)
                {
                    //if (iCol == 5) { iCol = 0; iRow++; }

                    if (iCtr > Constants.C_RESTOPLUS_MAX_TABLES)
                    {
                        break;
                    }

                    if (iCtr == 1)
                    {
                        cmdTableLeft.Tag = dr[Data.ContactColumnNames.SequenceNo].ToString();
                    }
                    if (iCtr >= 1 && dtContact.Rows.Count > Constants.C_RESTOPLUS_MAX_TABLES)
                    {
                        cmdTableRight.Tag = dr[Data.ContactColumnNames.SequenceNo].ToString();
                    }

                    ProductButton cmdTable = new ProductButton();

                    cmdTable.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
                    cmdTable.BackColor    = System.Drawing.Color.Red;
                    cmdTable.Dock         = System.Windows.Forms.DockStyle.Fill;
                    cmdTable.FlatAppearance.BorderColor = System.Drawing.Color.Gold;
                    cmdTable.Font                    = new System.Drawing.Font("Tahoma", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                    cmdTable.ForeColor               = System.Drawing.SystemColors.ControlText;
                    cmdTable.GradientBottom          = System.Drawing.Color.DarkRed;
                    cmdTable.GradientTop             = System.Drawing.Color.Red;
                    cmdTable.ImageAlign              = System.Drawing.ContentAlignment.TopCenter;
                    cmdTable.Location                = new System.Drawing.Point(3, 3);
                    cmdTable.Size                    = new System.Drawing.Size(245, 90);
                    cmdTable.TabIndex                = 118;
                    cmdTable.TextAlign               = System.Drawing.ContentAlignment.BottomCenter;
                    cmdTable.TextImageRelation       = System.Windows.Forms.TextImageRelation.ImageAboveText;
                    cmdTable.UseVisualStyleBackColor = false;

                    cmdTable.Name   = "cmdTable" + iCtr.ToString();
                    cmdTable.Text   = dr[Data.ContactColumnNames.ContactCode].ToString();
                    cmdTable.Tag    = dr[Data.ContactColumnNames.ContactID].ToString();
                    cmdTable.Click += new System.EventHandler(cmdTable_Click);

                    if (DateTime.Parse(dr[Data.ContactColumnNames.LastCheckInDate].ToString()) != Constants.C_DATE_MIN_VALUE)
                    {
                        TimeSpan iLapse = DateTime.Now - DateTime.Parse(dr[Data.ContactColumnNames.LastCheckInDate].ToString());

                        Label lblLastCheckInDate = new System.Windows.Forms.Label();
                        lblLastCheckInDate.AutoSize  = true;
                        lblLastCheckInDate.BackColor = System.Drawing.Color.Transparent;
                        lblLastCheckInDate.Font      = new System.Drawing.Font("Tahoma", 7.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                        lblLastCheckInDate.ForeColor = System.Drawing.Color.Blue;
                        lblLastCheckInDate.Location  = new System.Drawing.Point(5, 5);
                        lblLastCheckInDate.Name      = "lblLastCheckInDate" + iCtr.ToString();
                        lblLastCheckInDate.TabIndex  = 1;
                        lblLastCheckInDate.Text      = "CheckIn: " + DateTime.Parse(dr[Data.ContactColumnNames.LastCheckInDate].ToString()).ToString("dd-MMM hh:mm tt") + "   [" + iLapse.Hours.ToString("0#") + "hrs " + iLapse.Minutes.ToString("0#") + "mins]";
                        cmdTable.Controls.Add(lblLastCheckInDate);
                    }

                    string stTransactionNo = clsSalesTransactions.getSuspendedTransactionNo(long.Parse(dr[Data.ContactColumnNames.ContactID].ToString()), TerminalDetails.TerminalNo, TerminalDetails.BranchID);
                    if (stTransactionNo != string.Empty)
                    {
                        clsSalesTransactionDetails = clsSalesTransactions.Details(stTransactionNo, TerminalDetails.TerminalNo, TerminalDetails.BranchID);
                        cmdTable.Text = dr[Data.ContactColumnNames.ContactCode].ToString();

                        decimal decAmountDue = Convert.ToDecimal(clsSalesTransactionDetails.SubTotal + clsSalesTransactionDetails.Charge - clsSalesTransactionDetails.Discount);
                        cmdTable.Text += Environment.NewLine + Environment.NewLine + "Amount Due:" + decAmountDue.ToString("#,###.#0");

                        Label lblNoOfPax = new System.Windows.Forms.Label();
                        lblNoOfPax.AutoSize  = true;
                        lblNoOfPax.BackColor = System.Drawing.Color.Transparent;
                        lblNoOfPax.Font      = new System.Drawing.Font("Tahoma", 7.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                        lblNoOfPax.ForeColor = System.Drawing.Color.White;
                        lblNoOfPax.Location  = new System.Drawing.Point(210, 75);
                        lblNoOfPax.Name      = "lblNoOfPax" + iCtr.ToString();
                        lblNoOfPax.TabIndex  = 1;
                        lblNoOfPax.Text      = clsSalesTransactionDetails.PaxNo.ToString() + "Pax";
                        cmdTable.Controls.Add(lblNoOfPax);

                        if (mboShowAvailableTableOnly)
                        {
                            cmdTable.BackColor      = System.Drawing.Color.DarkGray;
                            cmdTable.GradientBottom = System.Drawing.Color.DarkGray;
                            cmdTable.GradientTop    = System.Drawing.Color.LightGray;
                            cmdTable.Enabled        = false;
                        }
                        else
                        {
                            cmdTable.BackColor      = System.Drawing.Color.DarkBlue;
                            cmdTable.GradientBottom = System.Drawing.Color.DarkBlue;
                            cmdTable.GradientTop    = System.Drawing.Color.LightBlue;
                        }
                    }

                    Label lblMerge = new System.Windows.Forms.Label();
                    lblMerge.AutoSize  = true;
                    lblMerge.BackColor = System.Drawing.Color.Transparent;
                    lblMerge.Font      = new System.Drawing.Font("Tahoma", 7.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                    lblMerge.ForeColor = System.Drawing.Color.White;
                    lblMerge.Location  = new System.Drawing.Point(5, 75);
                    lblMerge.Name      = "lblMerge" + iCtr.ToString();
                    lblMerge.TabIndex  = 1;
                    lblMerge.Text      = "Merged";
                    lblMerge.Visible   = false;
                    cmdTable.Controls.Add(lblMerge);

                    clsMergeTableDetails = clsMergeTable.Details(dr[Data.ContactColumnNames.ContactCode].ToString());

                    if (MainTableToMerge.ContactCode == dr[Data.ContactColumnNames.ContactCode].ToString())
                    {
                        cmdTable.BackColor      = System.Drawing.Color.LightGreen;
                        cmdTable.GradientBottom = System.Drawing.Color.LightGreen;
                        cmdTable.GradientTop    = System.Drawing.Color.DarkGreen;
                        cmdTable.Enabled        = false;
                        cmdTable.Controls["lblMerge" + cmdTable.Name.Replace("cmdTable", "")].Visible = true;
                        cmdTable.Controls["lblMerge" + cmdTable.Name.Replace("cmdTable", "")].Text    = "Merged to this table";
                    }
                    else if (clsMergeTableDetails.MainTableCode == dr[Data.ContactColumnNames.ContactCode].ToString())
                    {
                        cmdTable.BackColor      = System.Drawing.Color.DarkGray;
                        cmdTable.GradientBottom = System.Drawing.Color.DarkGray;
                        cmdTable.GradientTop    = System.Drawing.Color.LightGray;
                        cmdTable.Enabled        = false;
                        cmdTable.Controls["lblMerge" + cmdTable.Name.Replace("cmdTable", "")].Visible = true;
                        cmdTable.Controls["lblMerge" + cmdTable.Name.Replace("cmdTable", "")].Text    = "Merged - Main Table";
                    }
                    else if (clsMergeTableDetails.ChildTableCode == dr[Data.ContactColumnNames.ContactCode].ToString() &&
                             MainTableToMerge.ContactCode != clsMergeTableDetails.MainTableCode)
                    {
                        cmdTable.BackColor      = System.Drawing.Color.DarkGray;
                        cmdTable.GradientBottom = System.Drawing.Color.DarkGray;
                        cmdTable.GradientTop    = System.Drawing.Color.LightGray;
                        cmdTable.Enabled        = false;
                        cmdTable.Controls["lblMerge" + cmdTable.Name.Replace("cmdTable", "")].Visible = true;
                        cmdTable.Controls["lblMerge" + cmdTable.Name.Replace("cmdTable", "")].Text    = "Merged to " + clsMergeTableDetails.MainTableCode;
                    }
                    else if (clsMergeTableDetails.ChildTableCode == dr[Data.ContactColumnNames.ContactCode].ToString() &&
                             MainTableToMerge.ContactCode == clsMergeTableDetails.MainTableCode)
                    {
                        Data.ContactDetails clsContactDetails = clsContact.Details(long.Parse(cmdTable.Tag.ToString()));
                        mlstTables.Add(clsContactDetails);
                        cmdTable.Controls["lblMerge" + cmdTable.Name.Replace("cmdTable", "")].Visible = true;
                        cmdTable.Controls["lblMerge" + cmdTable.Name.Replace("cmdTable", "")].Text    = "Merged to " + clsMergeTableDetails.MainTableCode;
                        cmdTable.GradientTop = System.Drawing.Color.Orange;
                    }

                    tblLayout.Controls.Add(cmdTable, iCol, iRow);

                    iCol++; iCtr++;
                }
                clsContact.CommitAndDispose();
            }
            catch (IndexOutOfRangeException) {}
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "RetailPlus", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#35
0
        private bool SaveRecord()
        {
            if (MessageBox.Show("Please validate the customer information details before proceeding. Are you sure you want to continue?", "RetailPlus ™", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.No)
            {
                return false;
            }
            else
            {
                Data.ContactDetails clsDetails = new Data.ContactDetails();
                clsDetails = mContactDetails;

                clsDetails.ContactCode = txtContactCode.Text;
                clsDetails.ContactName = txtLastName.Text + ", " + txtFirstName.Text + (string.IsNullOrEmpty(txtMiddleName.Text) ? "" : "," + txtMiddleName.Text);
                clsDetails.ContactGroupID = Convert.ToInt32(Constants.CONTACT_GROUP_CUSTOMER);
                clsDetails.ModeOfTerms = (ModeOfTerms)Enum.Parse(typeof(ModeOfTerms), cboTerms.SelectedItem.ToString());
                clsDetails.Terms = int.Parse(txtTerms.Text);
                clsDetails.TINNo = txtTelephoneNo.Tag == null ? "" : txtTelephoneNo.Tag.ToString();
                clsDetails.LTONo = txtRemarks.Tag == null ? "" : txtRemarks.Tag.ToString();
                clsDetails.Address = txtAddress.Text;
                clsDetails.BusinessName = "";
                clsDetails.TelephoneNo = txtTelephoneNo.Text;
                clsDetails.Remarks = txtRemarks.Text;
                clsDetails.Debit = Convert.ToDecimal("0");
                clsDetails.Credit = Convert.ToDecimal(txtCredit.Text);
                clsDetails.IsCreditAllowed = chkIsCreditAllowed.Checked;
                clsDetails.CreditLimit = Convert.ToDecimal(txtCreditLimit.Text);

                Data.ContactAddOnDetails clsAddOnDetails = new Data.ContactAddOnDetails();
                clsAddOnDetails.ContactID = clsDetails.ContactID;
                clsAddOnDetails.Salutation = cboSalutation.SelectedValue.ToString();
                clsAddOnDetails.FirstName = txtFirstName.Text;
                clsAddOnDetails.MiddleName = txtMiddleName.Text;
                clsAddOnDetails.LastName = txtLastName.Text;
                clsAddOnDetails.SpouseName = "";
                DateTime dteBirthDate = Constants.C_DATE_MIN_VALUE;
                dteBirthDate = DateTime.TryParse(txtBirthDate.Text, out dteBirthDate) ? dteBirthDate : Constants.C_DATE_MIN_VALUE;
                clsAddOnDetails.BirthDate = dteBirthDate;
                clsAddOnDetails.SpouseBirthDate = Constants.C_DATE_MIN_VALUE;
                clsAddOnDetails.AnniversaryDate = Constants.C_DATE_MIN_VALUE;
                clsAddOnDetails.Address1 = txtAddress.Text;
                clsAddOnDetails.Address2 = string.Empty;
                clsAddOnDetails.City = string.Empty;
                clsAddOnDetails.State = string.Empty;
                clsAddOnDetails.ZipCode = string.Empty;
                clsAddOnDetails.CountryID = Constants.C_DEF_COUNTRY_ID;
                clsAddOnDetails.CountryCode = Constants.C_DEF_COUNTRY_CODE;
                clsAddOnDetails.BusinessPhoneNo = txtTelephoneNo.Text;
                clsAddOnDetails.HomePhoneNo = string.Empty;
                clsAddOnDetails.MobileNo = txtMobileNo.Text;
                clsAddOnDetails.FaxNo = string.Empty;
                clsAddOnDetails.EmailAddress = string.Empty;
                clsAddOnDetails.Sex = (Sex) Enum.Parse(typeof(Sex), cboSex.SelectedValue.ToString());
                clsAddOnDetails.AttendingPhysician = txtAttendingPhysician.Text;

                clsDetails.AdditionalDetails = clsAddOnDetails;

                Data.Contacts clsContact = new Data.Contacts();
                if (mContactDetails.ContactID == 0)
                {
                    clsDetails.ContactGroupID = Constants.CONTACT_GROUP_CUSTOMER;
                    clsDetails.PositionID = Constants.C_RETAILPLUS_AGENT_POSITIONID;
                    clsDetails.DepartmentID = Constants.C_RETAILPLUS_AGENT_DEPARTMENTID;
                    clsDetails.ContactID = clsContact.Insert(clsDetails);
                }
                else
                {
                    clsDetails.PositionID = mContactDetails.PositionID;
                    clsDetails.DepartmentID = mContactDetails.DepartmentID;
                    clsDetails.ContactGroupID = mContactDetails.ContactGroupID;
                    clsDetails.ContactGroupName = mContactDetails.ContactGroupName;
                    clsContact.Update(clsDetails);
                }
                clsContact.CommitAndDispose();

                mContactDetails = clsDetails;

                return true;
            }
        }
示例#36
0
        private void ContactUpdate()
        {
            try
            {
                if (!EnableContactAddUpdate)
                {
                    return;
                }

                Int64 iContactID = Convert.ToInt64(dgContacts[dgContacts.CurrentRowIndex, 0].ToString());

                if (iContactID != 0 && iContactID != Constants.C_RETAILPLUS_CUSTOMERID)
                {
                    Data.Contacts       clsContact = new Data.Contacts();
                    Data.ContactDetails details    = clsContact.Details(iContactID);
                    clsContact.CommitAndDispose();

                    DialogResult addresult = System.Windows.Forms.DialogResult.Cancel;

                    switch (SysConfigDetails.ContactAddWndType)
                    {
                    case ContactAddWndType.ContactAddWnd:
                    case ContactAddWndType.ContactAddNoLTOWnd:
                        ContactAddWnd clsContactAddWnd = new ContactAddWnd();
                        clsContactAddWnd.Caption          = "Update Customer [" + details.ContactName + "]";
                        clsContactAddWnd.ContactDetails   = details;
                        clsContactAddWnd.TerminalDetails  = TerminalDetails;
                        clsContactAddWnd.SysConfigDetails = SysConfigDetails;
                        clsContactAddWnd.ShowDialog(this);
                        addresult = clsContactAddWnd.Result;
                        details   = clsContactAddWnd.ContactDetails;
                        clsContactAddWnd.Close();
                        clsContactAddWnd.Dispose();
                        break;

                    case ContactAddWndType.ContactAddHCareWnd:
                        ContactAddHCareWnd clsContactAddHCareWnd = new ContactAddHCareWnd();
                        clsContactAddHCareWnd.Caption         = "Update Customer [" + details.ContactName + "]";
                        clsContactAddHCareWnd.ContactDetails  = details;
                        clsContactAddHCareWnd.TerminalDetails = TerminalDetails;
                        clsContactAddHCareWnd.ShowDialog(this);
                        addresult = clsContactAddHCareWnd.Result;
                        details   = clsContactAddHCareWnd.ContactDetails;
                        clsContactAddHCareWnd.Close();
                        clsContactAddHCareWnd.Dispose();
                        break;

                    default:
                        ContactAddDetWnd clsContactAddDetWnd = new ContactAddDetWnd();
                        clsContactAddDetWnd.Caption         = "Update Customer [" + details.ContactName + "]";
                        clsContactAddDetWnd.ContactDetails  = details;
                        clsContactAddDetWnd.TerminalDetails = TerminalDetails;
                        clsContactAddDetWnd.ShowDialog(this);
                        addresult = clsContactAddDetWnd.Result;
                        details   = clsContactAddDetWnd.ContactDetails;
                        clsContactAddDetWnd.Close();
                        clsContactAddDetWnd.Dispose();
                        break;
                    }
                    if (addresult == DialogResult.OK)
                    {
                        txtSearch.Text = details.ContactCode;
                        LoadContactData();
                    }
                }
            }
            catch { }
        }
示例#37
0
		private void CreateDetails(int iRow)
		{
			mDetails = new ContactDetails();
			Customer clsCustomer = new Customer();
			mDetails = clsCustomer.Details(Convert.ToInt64(dgContacts[iRow, 0].ToString()));
			clsCustomer.CommitAndDispose();

			////int iRow = dgContacts.CurrentRowIndex;

			//mDetails.ContactID = Convert.ToInt64(dgContacts[iRow, 0].ToString());
			//mDetails.ContactCode = dgContacts[iRow, 1].ToString();
			//mDetails.ContactName = dgContacts[iRow, 2].ToString();
			//mDetails.Debit = Convert.ToDecimal(dgContacts[iRow, 3].ToString());
			//mDetails.Credit = Convert.ToDecimal(dgContacts[iRow, 4].ToString());
			//mDetails.CreditLimit = Convert.ToDecimal(dgContacts[iRow, 5].ToString());
			//mDetails.IsCreditAllowed = Convert.ToInt16(dgContacts[iRow, 6].ToString());
			//mDetails.PositionName = dgContacts[iRow, 7].ToString();
			//mDetails.DepartmentName = dgContacts[iRow, 8].ToString();
		}
示例#38
0
        private bool SaveRecord()
        {
            if (MessageBox.Show("Please validate the customer information details before proceeding. Are you sure you want to continue?", "RetailPlus ™", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.No)
            {
                return false;
            }
            else
            {
                Data.ContactDetails clsDetails = new Data.ContactDetails();
                clsDetails = mContactDetails;

                clsDetails.ContactCode = txtContactCode.Text;
                clsDetails.ContactName = txtCustomerName.Text;
                clsDetails.TINNo = txtTINNo.Text;
                clsDetails.LTONo = txtLTONo.Text;
                clsDetails.Address = txtAddress.Text;
                clsDetails.BusinessName = txtBusinessName.Text;
                clsDetails.TelephoneNo = txtTelNo.Text;

                // Jul 22, 2014
                clsDetails.Debit = mContactDetails.Debit;
                clsDetails.Credit = mContactDetails.Credit;
                clsDetails.IsCreditAllowed = chkIsCreditAllowed.Checked;
                clsDetails.CreditLimit = decimal.Parse(txtCreditLimit.Text);
                clsDetails.Terms = int.Parse(txtTerms.Text);
                clsDetails.ModeOfTerms = (ModeOfTerms)Enum.Parse(typeof(ModeOfTerms), cboTerms.SelectedItem.ToString());


                Data.Contacts clsContact = new Data.Contacts();
                Data.ContactGroups clsContactGroups = new Data.ContactGroups(clsContact.Connection, clsContact.Transaction);
                clsDetails.ContactGroupID = clsContactGroups.DetailsByName(cboGroup.SelectedItem.ToString()).ContactGroupID;
                
                if (mContactDetails.ContactID == 0)
                {
                    //if (mstCaption == "Please enter customer name for deposit.")
                    //{ clsDetails.Remarks = Data.Contacts.DEFAULT_REMARKS_FOR_ADDED_FROM_DEPOSIT; }
                    //else if (mstCaption == "Quickly add new customer")
                    //{ clsDetails.Remarks = Data.Contacts.DEFAULT_REMARKS_FOR_QUICKLY_ADDED_FROM_FE; }
                    //else if (mContactDetails.ContactID == 0) // means not edit
                    //{ clsDetails.Remarks = Data.Contacts.DEFAULT_REMARKS_FOR_ADDED_FROM_CLIENT; }
                    clsDetails.Remarks = txtRemarks.Text;

                    clsDetails.PositionID = Constants.C_RETAILPLUS_AGENT_POSITIONID;
                    clsDetails.DepartmentID = Constants.C_RETAILPLUS_AGENT_DEPARTMENTID;
                    clsDetails.ContactID = clsContact.Insert(clsDetails);
                }
                else
                {
                    clsDetails.PositionID = mContactDetails.PositionID;
                    clsDetails.DepartmentID = mContactDetails.DepartmentID;
                    clsDetails.ContactGroupID = mContactDetails.ContactGroupID;
                    clsDetails.ContactGroupName = mContactDetails.ContactGroupName;
                    clsContact.Update(clsDetails);
                }
                clsContact.CommitAndDispose();

                mContactDetails = clsDetails;

                return true;
            }
        }
示例#39
0
        private void PriceInquiryWnd_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
        {
            switch (e.KeyData)
            {
            case Keys.Escape:
                dialog = DialogResult.Cancel;
                this.Hide();
                break;

            case Keys.Enter:
                if (txtBarCode.Text.Trim() != string.Empty)
                {
                    ClearProduct();
                    Data.Products       clsProduct        = new Data.Products();
                    Data.ProductDetails clsProductDetails = clsProduct.Details(TerminalDetails.BranchID, txtBarCode.Text.Trim());
                    if (clsProductDetails.ProductID == 0)
                    {
                        string strContactCardNo = txtBarCode.Text.Trim();

                        Data.Contacts       clsContact        = new Data.Contacts(clsProduct.Connection, clsProduct.Transaction);
                        Data.ContactDetails clsContactDetails = clsContact.DetailsByRewardCardNo(strContactCardNo);
                        if (clsContactDetails.ContactID == 0)
                        {
                            clsContactDetails = clsContact.DetailsByCreditCardNo(strContactCardNo);
                            if (clsContactDetails.ContactID == 0)
                            {
                                strContactCardNo  = strContactCardNo.Remove(strContactCardNo.Length - 1);
                                clsContactDetails = clsContact.DetailsByRewardCardNo(strContactCardNo);
                                if (clsContactDetails.ContactID == 0)
                                {
                                    clsContactDetails = clsContact.DetailsByCreditCardNo(strContactCardNo);
                                    if (clsContactDetails.ContactID == 0)
                                    {
                                        ClearProduct();
                                    }
                                    else
                                    {
                                        decimal decAvailableCreditLimit = clsContactDetails.CreditLimit - clsContactDetails.Credit;

                                        lblProductDescription.Text = clsContactDetails.ContactName + " - " + clsContactDetails.CreditDetails.CreditCardNo;
                                        lblPrice.Text      = decAvailableCreditLimit.ToString("#,##0.#0");
                                        lblPriceLabel.Text = "AVAILABLE CREDITS:";

                                        if (clsContactDetails.CreditDetails.CreditCardStatus == CreditCardStatus.Expired ||
                                            clsContactDetails.CreditDetails.CreditCardStatus == CreditCardStatus.Lost)
                                        {
                                            lblProductDescription.Text += "(" + clsContactDetails.CreditDetails.CreditCardStatus.ToString("G").ToLower() + ")";
                                        }
                                        else
                                        {
                                            lblProductDescription.Text += "(active)";
                                        }
                                    }
                                }
                                else
                                {
                                    lblProductDescription.Text = clsContactDetails.ContactName + " - " + clsContactDetails.RewardDetails.RewardCardNo;
                                    lblPrice.Text      = clsContactDetails.RewardDetails.RewardPoints.ToString("#,##0.#0");
                                    lblPriceLabel.Text = "AVAILABLE POINTS:";

                                    if (clsContactDetails.RewardDetails.RewardCardStatus == RewardCardStatus.Expired ||
                                        clsContactDetails.RewardDetails.RewardCardStatus == RewardCardStatus.Lost)
                                    {
                                        lblProductDescription.Text += "(" + clsContactDetails.RewardDetails.RewardCardStatus.ToString("G").ToLower() + ")";
                                    }
                                    else
                                    {
                                        lblProductDescription.Text += "(active)";
                                    }
                                }
                            }
                            else
                            {
                                decimal decAvailableCreditLimit = clsContactDetails.CreditLimit - clsContactDetails.Credit;

                                lblProductDescription.Text = clsContactDetails.ContactName + " - " + clsContactDetails.CreditDetails.CreditCardNo;
                                lblPrice.Text      = decAvailableCreditLimit.ToString("#,##0.#0");
                                lblPriceLabel.Text = "AVAILABLE CREDITS:";

                                if (clsContactDetails.CreditDetails.CreditCardStatus == CreditCardStatus.Expired ||
                                    clsContactDetails.CreditDetails.CreditCardStatus == CreditCardStatus.Lost)
                                {
                                    lblProductDescription.Text += "(" + clsContactDetails.CreditDetails.CreditCardStatus.ToString("G").ToLower() + ")";
                                }
                                else
                                {
                                    lblProductDescription.Text += "(active)";
                                }
                            }
                        }
                        else
                        {
                            lblProductDescription.Text = clsContactDetails.ContactName + " - " + clsContactDetails.RewardDetails.RewardCardNo;
                            lblPrice.Text      = clsContactDetails.RewardDetails.RewardPoints.ToString("#,##0.#0");
                            lblPriceLabel.Text = "AVAILABLE POINTS:";

                            if (clsContactDetails.RewardDetails.RewardCardStatus == RewardCardStatus.Expired ||
                                clsContactDetails.RewardDetails.RewardCardStatus == RewardCardStatus.Lost)
                            {
                                lblProductDescription.Text += "(" + clsContactDetails.RewardDetails.RewardCardStatus.ToString("G").ToLower() + ")";
                            }
                            else
                            {
                                lblProductDescription.Text += "(active)";
                            }
                        }
                    }
                    else
                    {
                        lblProductDescription.Text = clsProductDetails.ProductDesc;
                        lblPrice.Text      = clsProductDetails.Price.ToString("#,##0.#0");
                        lblPriceLabel.Text = "PRICE:";
                    }
                    clsProduct.CommitAndDispose();
                    txtBarCode.Text = "";
                }
                txtBarCode.Focus();
                txtBarCode.SelectAll();
                break;
            }
        }
        private void LoadData()
        {
            mContactDetails = new Data.ContactDetails();
            mGuarantorDetails = new Data.ContactDetails();

            Data.Contacts clsContacts = new Data.Contacts();
            switch (SysConfigDetails.CreditPaymentType)
            {
                case CreditPaymentType.Houseware:
                    mContactDetails = clsContacts.DetailsByCreditCardNo(txtScan.Text);
                    break;
                case CreditPaymentType.Normal:
                case CreditPaymentType.MPC:
                default:
                    mContactDetails = clsContacts.Details(txtScan.Text);
                    break;
            }

            if (mContactDetails.ContactID == 0)
            {
                //mContactDetails = clsContacts.DetailsByCreditCardNo(txtScan.Text.Remove(txtScan.Text.Length - 1));

                if (mContactDetails.ContactID == 0 && txtScan.Text.Length == 7) mContactDetails = clsContacts.DetailsByCreditCardNo("888880" + txtScan.Text);
                if (mContactDetails.ContactID == 0 && txtScan.Text.Length == 7) mContactDetails = clsContacts.DetailsByCreditCardNo("800000" + txtScan.Text);
                if (mContactDetails.ContactID == 0 && txtScan.Text.Length == 9) mContactDetails = clsContacts.DetailsByCreditCardNo(BarcodeHelper.GroupCreditCard_Country_Code + BarcodeHelper.GroupCreditCard_ManufacturerCode + txtScan.Text);
                if (mContactDetails.ContactID == 0 && txtScan.Text.Length == 9) mContactDetails = clsContacts.DetailsByCreditCardNo(BarcodeHelper.CreditCard_Country_Code + BarcodeHelper.CreditCard_ManufacturerCode + txtScan.Text);
            }

            //get the guarantor details if with details
            if (mContactDetails.ContactID != 0)
                if (mContactDetails.ContactID == mContactDetails.CreditDetails.GuarantorID)
                    mGuarantorDetails = mContactDetails;
                else if (mGuarantorDetails.ContactID != mContactDetails.CreditDetails.GuarantorID)
                    mGuarantorDetails = clsContacts.Details(mContactDetails.CreditDetails.GuarantorID);

            clsContacts.CommitAndDispose();


            if (mContactDetails.ContactID == 0)
            {
                grpContactDetails.Visible = false;
                grpPurchases.Visible = false;
                labelGuarantor.Visible = false;
                txtGuarantor.Visible = false;
            }
            else
            {
                grpContactDetails.Visible = true;
                grpPurchases.Visible = true;

                txtScan.Text = mContactDetails.CreditDetails.CreditCardNo;
                txtCustomerName.Text = mContactDetails.ContactName;
                txtMobileNo.Text = mContactDetails.AdditionalDetails.MobileNo;
                txtTelNo.Text = mContactDetails.TelephoneNo;
                txtAddress.Text = mContactDetails.Address;
                txtRemarks.Text = mContactDetails.Remarks;

                txtCreditCardStatus.Text = mContactDetails.CreditDetails.CreditActive ? "Active" : "InActive";
                txtCreditCardStatus.Text += "(" + mContactDetails.CreditDetails.CreditCardStatus.ToString("G") + ")";
                txtCreditLimit.Text = mContactDetails.CreditLimit.ToString("#,##0.#0");
                txtCredit.Text = mContactDetails.Credit.ToString("#,##0.#0");
                txtAvailableCredit.Text = (mContactDetails.CreditLimit - mContactDetails.Credit).ToString("#,##0.#0");

                if (!mContactDetails.CreditDetails.CardTypeDetails.WithGuarantor) //no guarantor
                {
                    labelCreditStatus.Location = new Point(71, 133);
                    txtCreditCardStatus.Location = new Point(174, 133);
                    txtCreditCardStatus.Size = new Size(439, 30);
                    labelGuarantor.Visible = false;
                    txtGuarantor.Visible = false;
                }
                else if (mContactDetails.CreditDetails.CardTypeDetails.WithGuarantor) //with guarantor
                {
                    labelCreditStatus.Location = new Point(627, 133);
                    txtCreditCardStatus.Location = new Point(731, 133);
                    txtCreditCardStatus.Size = new Size(269, 30);
                    labelGuarantor.Visible = true;
                    txtGuarantor.Visible = true;

                    txtGuarantor.Text = "[" + (mGuarantorDetails.CreditDetails.CreditActive ? "Active" : "InActive") + "] " + mGuarantorDetails.ContactCode + ":" + mGuarantorDetails.ContactName;
                }

                LoadPurchases();
                lblBalance.Text = mContactDetails.Credit.ToString("#,##0.#0");
            }
        }