Пример #1
0
        private void Expenses_Load(object sender, EventArgs e)
        {
            if (Properties.Settings.Default.TouchOriented)
            {
                toolStripButtonVirtualKb.Visible = true;
            }

            // TODO: This line of code loads data into the 'dataSetExpenseTypes.sol_ExpenseTypes_SelectAll' table. You can move, or remove it, as needed.
            this.sol_ExpenseTypes_SelectAllTableAdapter.Fill(this.dataSetExpenseTypes.sol_ExpenseTypes_SelectAll);
            // TODO: This line of code loads data into the 'dataSetCashTrays.sol_CashTrays_SelectAll' table. You can move, or remove it, as needed.
            this.sol_CashTrays_SelectAllTableAdapter.Fill(this.dataSetCashTrays.sol_CashTrays_SelectAll);

            sol_Entrie    = new Sol_Entrie();
            sol_Entrie_Sp = new Sol_Entrie_Sp(Properties.Settings.Default.WsirDbConnectionString);

            //disable form resizing
            this.FormBorderStyle = FormBorderStyle.FixedSingle;

            //current cashtray
            flagInicio = true;
            comboBoxCashTray.SelectedValue = Properties.Settings.Default.SettingsCurrentCashTray;
            flagInicio = false;

            if (SolFunctions.IsCashierClosed(ref sol_Entrie, sol_Entrie_Sp, Properties.Settings.Default.SettingsCurrentCashTray))
            {
                DialogResult result = MessageBox.Show("The default cash tray is not open. You cannot add an expense!. Are you sure you want to continue?", "", MessageBoxButtons.YesNo);
                if (result != System.Windows.Forms.DialogResult.Yes)
                {
                    Close();
                    return;
                }
                buttonSave.Enabled = false;
            }
        }
Пример #2
0
        public static bool IsCashierClosed(ref Sol_Entrie sol_Entrie, Sol_Entrie_Sp sol_Entrie_Sp, int cashTrayID)
        {
            //open cashier
            sol_Entrie = sol_Entrie_Sp.SelectLastType("O", cashTrayID);
            DateTime OpenLatestDate;

            if (sol_Entrie == null)
            {
                OpenLatestDate = DateTime.MinValue;
            }
            else
            {
                OpenLatestDate = sol_Entrie.Date;
            }
            //close cashier
            sol_Entrie = sol_Entrie_Sp.SelectLastType("C", cashTrayID);
            DateTime CloseLatestDate;

            if (sol_Entrie == null)
            {
                CloseLatestDate = DateTime.MinValue;
            }
            else
            {
                CloseLatestDate = sol_Entrie.Date;
            }

            return(CloseLatestDate >= OpenLatestDate);
        }
Пример #3
0
        public static bool CheckCashier()
        {
            Sol_Entrie    sol_Entrie    = new Sol_Entrie();
            Sol_Entrie_Sp sol_Entrie_Sp = new Sol_Entrie_Sp(Properties.Settings.Default.WsirDbConnectionString);

            if (SolFunctions.IsCashierClosed(ref sol_Entrie, sol_Entrie_Sp, Properties.Settings.Default.SettingsCurrentCashTray))
            {
                //*************************************************
                //check if the Main.rc is enabled (RelojCalendario)
                //*************************************************
                //MessageBox.Show("You need to Open a new Cashier before using this option!");  //can pay a Return!");
                //Close();
                return(false);
            }
            return(true);
        }
Пример #4
0
        private void Float_Load(object sender, EventArgs e)
        {
            if (Properties.Settings.Default.TouchOriented)
            {
                toolStripButtonVirtualKb.Visible = true;
            }

            // TODO: This line of code loads data into the 'dataSetCashTraysLookup.sol_CashTrays' table. You can move, or remove it, as needed.
            this.sol_CashTraysTableAdapter.Fill(this.dataSetCashTraysLookup.sol_CashTrays);

            sol_Entrie           = new Sol_Entrie();
            sol_Entrie_Sp        = new Sol_Entrie_Sp(Properties.Settings.Default.WsirDbConnectionString);
            sol_EntriesDetail    = new Sol_EntriesDetail();
            sol_EntriesDetail_Sp = new Sol_EntriesDetail_Sp(Properties.Settings.Default.WsirDbConnectionString);

            //disable form resizing
            this.FormBorderStyle = FormBorderStyle.FixedSingle;

            flagInicio = true;
            //current cashtray
            //int currentTray = Properties.Settings.Default.SettingsCurrentCashTray;

            comboBoxCashTray.SelectedValue = Properties.Settings.Default.SettingsCurrentCashTray;
            flagInicio = false;



            dataGridViewFloat.ColumnCount = 9;
            dataGridViewFloat.ColumnHeadersDefaultCellStyle.BackColor = Color.Navy;
            dataGridViewFloat.ColumnHeadersDefaultCellStyle.ForeColor = Color.White;
            //dataGridViewFloat.ColumnHeadersDefaultCellStyle.Font =
            //    new Font(dataGridViewFloat.Font, FontStyle.Bold);

            //dataGridViewFloat.Name = "dataGridViewFloat";
            //dataGridViewFloat.Location = new Point(8, 8);
            //dataGridViewFloat.Size = new Size(500, 250);
            dataGridViewFloat.AutoSizeRowsMode =
                DataGridViewAutoSizeRowsMode.DisplayedCellsExceptHeaders;
            dataGridViewFloat.ColumnHeadersBorderStyle =
                DataGridViewHeaderBorderStyle.Single;

            dataGridViewFloat.CellBorderStyle    = DataGridViewCellBorderStyle.Single;
            dataGridViewFloat.GridColor          = Color.Black;
            dataGridViewFloat.RowHeadersVisible  = false;
            dataGridViewFloat.AllowUserToAddRows = false;

            int index = 0;

            //0
            dataGridViewFloat.Columns[index].Name = "Denomination";
            dataGridViewFloat.Columns[index].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
            dataGridViewFloat.Columns[index].Width      = 160;
            dataGridViewFloat.Columns[index++].ReadOnly = true;
            //1
            dataGridViewFloat.Columns[index].Name       = "Type";
            dataGridViewFloat.Columns[index].Width      = 90;
            dataGridViewFloat.Columns[index++].ReadOnly = true;
            //2
            dataGridViewFloat.Columns[index].Name = "Count";
            dataGridViewFloat.Columns[index].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
            dataGridViewFloat.Columns[index++].Width = 80;
            //3
            dataGridViewFloat.Columns[index].Name = "Total";
            dataGridViewFloat.Columns[index].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
            dataGridViewFloat.Columns[index].Width      = 120;
            dataGridViewFloat.Columns[index++].ReadOnly = true;
            //4
            dataGridViewFloat.Columns[index].Name = "CashID";
            dataGridViewFloat.Columns[index].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
            dataGridViewFloat.Columns[index].Width    = 120;
            dataGridViewFloat.Columns[index].ReadOnly = true;
            //dataGridViewFloat.Columns[index++].Visible = false;
            //5
            //CashValue
            dataGridViewFloat.Columns[index].Name  = "CashValue";
            dataGridViewFloat.Columns[index].Width = 150;
            //dataGridViewFloat.Columns[index++].Visible = false;
            //6
            //Cash Item value
            dataGridViewFloat.Columns[index].Name  = "CashItemValue";
            dataGridViewFloat.Columns[index].Width = 150;
            //dataGridViewFloat.Columns[index++].Visible = false;

            //7
            //Quantity
            dataGridViewFloat.Columns[index].Name  = "Quantity";
            dataGridViewFloat.Columns[index].Width = 150;
            //dataGridViewFloat.Columns[index++].Visible = false;

            //8
            //MoneyID
            dataGridViewFloat.Columns[index].Name  = "MoneyID";
            dataGridViewFloat.Columns[index].Width = 150;
            //dataGridViewFloat.Columns[index++].Visible = false;


            closingDate = Main.rc.FechaActual;

            readCashDenominations();


            if (entryName == "Open")
            {
                this.Text              = "Open Cashier";
                entryType              = "O";
                labelTotal1.Text       = "Last Closing Value:";
                labelTotal2.Text       = "Opening Value:";
                labelTotal3.Text       = "";//New Value of Float:";
                labelTotalAmount3.Text = "";

                if (!SolFunctions.IsCashierClosed(ref sol_Entrie, sol_Entrie_Sp, Properties.Settings.Default.SettingsCurrentCashTray))
                {
                    DialogResult result = MessageBox.Show("The current cash tray is already open. You cannot open it until it is closed. Are you sure you want to continue?", "", MessageBoxButtons.YesNo);
                    if (result != System.Windows.Forms.DialogResult.Yes)
                    {
                        Close();
                        return;
                    }
                    buttonSave.Enabled = false;
                    //buttonUseLastClose.Enabled = false;
                }
                else
                {
                    buttonUseLastClose.Enabled = true;
                }
            }
            else if (entryName == "Float")
            {
                this.Text        = "Add Float";
                entryType        = "F";
                labelTotal1.Text = "Current Value of Float:";
                labelTotal2.Text = "Amount to add:";
                labelTotal3.Text = "New Value of Float:";
                //comboBoxCashTray.Enabled = false;

                if (SolFunctions.IsCashierClosed(ref sol_Entrie, sol_Entrie_Sp, Properties.Settings.Default.SettingsCurrentCashTray))
                {
                    buttonSave.Enabled = false;
                    MessageBox.Show("You need to Open a new Cashier before you can add a Float!");
                    //Close();
                    //return;
                }
            }
            else if (entryName == "Close")
            {
                this.Text        = "Close Cashier";
                entryType        = "C";
                labelTotal1.Text = "Calculated Float:";
                labelTotal2.Text = "Closing Amount Entered:";
                labelTotal3.Text = "Discrepancy:";

                if (Main.Sol_ControlInfo.SacCashTrayID >= 0)
                {
                    if (Main.Sol_ControlInfo.SacCashTrayID == (int)comboBoxCashTray.SelectedIndex)
                    {
                        buttonUseCalculatedInventory.Visible = true;
                    }
                }

                //buttonOpenDrawer.Visible = false;
                //comboBoxCashTray.Enabled = false;

                if (SolFunctions.IsCashierClosed(ref sol_Entrie, sol_Entrie_Sp, Properties.Settings.Default.SettingsCurrentCashTray))
                {
                    DialogResult result = MessageBox.Show("The current cash tray is already closed. You cannot close it until it is opened. Are you sure you want to continue?", "", MessageBoxButtons.YesNo);
                    if (result != System.Windows.Forms.DialogResult.Yes)
                    {
                        Close();
                        return;
                    }
                    buttonSave.Enabled = false;
                }
            }


            //SAC
            //leer opciones
            //if (sac_Setting_Sp == null)
            //    sac_Setting_Sp = new Sac_Setting_Sp(Properties.Settings.Default.WsirDbConnectionString);
            //sac_Setting = sac_Setting_Sp.Select("BillDispenserId");
            //if(sac_Setting != null)
            //    int.TryParse(sac_Setting.SetValue.ToString(), out billDispenserId);
            billDispenserId = 0;
        }