Exemplo n.º 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;
            }
        }
Exemplo n.º 2
0
        private void textBoxQuantity_TextChanged(object sender, EventArgs e)
        {
            this.textBoxDozen.TextChanged -= new System.EventHandler(this.textBoxDozen_TextChanged);
            int qty = 0;

            int.TryParse(textBoxQuantity.Text, out qty);
            textBoxDozen.Text              = SolFunctions.Quantity2Dozen(qty);
            this.textBoxDozen.TextChanged += new System.EventHandler(this.textBoxDozen_TextChanged);
        }
Exemplo n.º 3
0
        private void textBoxDefaultDozen_Click(object sender, EventArgs e)
        {
            decimal decValue = 0;

            decimal.TryParse(textBoxDefaultDozen.Text, out decValue);

            textBoxQuantity.Text = (decValue * 12).ToString();
            int intValue = 0;

            int.TryParse(textBoxQuantity.Text, out intValue);
            textBoxDozen.Text = SolFunctions.Quantity2Dozen(intValue);
        }
Exemplo n.º 4
0
        private void toolStripButtonLogOff_Click(object sender, EventArgs e)
        {
            SolFunctions.LogOff(ref toolStripStatusLabelUserName);
            SolFunctions.CheckComputerRole(ref toolStripButtonExit);

            if (!Main.CheckUserPermission(Properties.Settings.Default.WsirConnectionString, Properties.Settings.Default.UsuarioNombre, "SolShipping", true))
            {
                toolStripButtonExit.PerformClick();
                return;
            }

            CheckUserPermissions();
        }
Exemplo n.º 5
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);
        }
Exemplo n.º 6
0
        private void buttonRePrint_Click(object sender, EventArgs e)
        {
            this.Cursor = Cursors.WaitCursor;
            string errorMessage = string.Empty;
            bool   flag         = SolFunctions.PrintReceipt(listView1, "", ref errorMessage, Properties.Settings.Default.BarcodeEncoding
                                                            , buttonSource
                                                            , securityCode
                                                            , totalSelectedOrders
                                                            );

            this.Cursor = Cursors.Default;
            if (!flag)
            {
                MessageBox.Show("There was a problem printing the receipt, please try again.\nError: " + errorMessage);
            }
        }
Exemplo n.º 7
0
        private bool addItemStagedContainers(ref ListView lv1, string tagNumber, string product, int quantity, string container, int dozen)
        {
            string[]     str = new string[5];
            ListViewItem itm = new ListViewItem();

            str[0] = tagNumber;
            str[1] = product;
            str[2] = String.Format("{0,3:##,##0}", quantity);
            str[3] = container;
            str[4] = SolFunctions.Quantity2Dozen(quantity);
            itm    = new ListViewItem(str);
            lv1.Items.Add(itm);
            //this.arrayListViewCategoryId.Add(categoryId);

            return(true);
        }
Exemplo n.º 8
0
        private void comboBoxCashTray_SelectedIndexChanged(object sender, EventArgs e)
        {
            //ignore on startup
            if (flagInicio)
            {
                return;
            }

            buttonSave.Enabled = false;
            int cashTrayID = Convert.ToInt32(comboBoxCashTray.SelectedValue);

            if (!SolFunctions.IsCashierClosed(ref sol_Entrie, sol_Entrie_Sp, cashTrayID))
            {
                buttonSave.Enabled = true;
            }
        }
Exemplo n.º 9
0
        private void comboBoxCashTray_SelectedIndexChanged(object sender, EventArgs e)
        {
            //ignore on startup
            if (flagInicio)
            {
                return;
            }

            buttonSave.Enabled         = false;
            buttonUseLastClose.Enabled = false;
            int cashTrayID = Convert.ToInt32(comboBoxCashTray.SelectedValue);

            if (entryName == "Open")
            {
                if (SolFunctions.IsCashierClosed(ref sol_Entrie, sol_Entrie_Sp, cashTrayID))
                {
                    buttonSave.Enabled         = true;
                    buttonUseLastClose.Enabled = true;
                }
            }
            else if (entryName == "Float")
            {
                if (!SolFunctions.IsCashierClosed(ref sol_Entrie, sol_Entrie_Sp, cashTrayID))
                {
                    buttonSave.Enabled = true;
                }
            }
            else if (entryName == "Close")
            {
                if (!SolFunctions.IsCashierClosed(ref sol_Entrie, sol_Entrie_Sp, cashTrayID))
                {
                    buttonSave.Enabled = true;
                }
            }

            //if (!SolFunctions.IsCashierClosed(ref sol_Entrie, sol_Entrie_Sp, cashTrayID))
            //{
            //    MessageBox.Show("You need to Close the Cashier before you can Open a new one!\n"+
            //        "Change the Default CashTray in Settings to Close it!");
            //    comboBoxCashTray.SelectedValue = Properties.Settings.Default.SettingsCurrentCashTray;
            //    return;

            //}

            //Properties.Settings.Default.SettingsCurrentCashTray = comboBoxCashTray.SelectedIndex;
            //Properties.Settings.Default.Save();
        }
Exemplo n.º 10
0
        private void buttonRePrint_Click(object sender, EventArgs e)
        {
            this.Cursor = Cursors.WaitCursor;

            string errorMessage = string.Empty;
            bool   flag         = SolFunctions.PrintReceipt(
                listView1, "paynow"
                , ref errorMessage, Properties.Settings.Default.BarcodeEncoding
                , "RePrint"
                , String.Empty
                , 0.0m
                );

            if (!flag)
            {
                MessageBox.Show("There was a problem printing the receipt, please try again.\nError: " + errorMessage);
            }

            this.Cursor = Cursors.Default;
        }
Exemplo n.º 11
0
        private void FillForm()
        {
            //textBoxStageID.Text = sol_Stage.StageID.ToString();

            textBoxUserName.Text = sol_Stage.UserName;
            textBoxDate.Text     = sol_Stage.Date.ToString("G");


            this.comboBoxProducts.SelectedIndexChanged -= new System.EventHandler(this.comboBoxProducts_SelectedIndexChanged);
            comboBoxProducts.SelectedValue              = sol_Stage.ProductID;
            this.comboBoxProducts.SelectedIndexChanged += new System.EventHandler(this.comboBoxProducts_SelectedIndexChanged);
            //comboBoxProducts.Text = sol_Stage.ProductName;

            comboBoxContainers.SelectedValue = sol_Stage.ContainerID;
            //comboBoxContainers.Text = sol_Stage.ContainerDescription;

            textBoxQuantity.Text = sol_Stage.Quantity.ToString();
            textBoxDozen.Text    = SolFunctions.Quantity2Dozen(sol_Stage.Quantity);
            textBoxRemarks.Text  = sol_Stage.Remarks;
        }
Exemplo n.º 12
0
        private void buttonContinue_Click(object sender, EventArgs e)
        {
            //check max amount
            if (Main.Sol_ControlInfo.CashierMaxAmount > 0.00m)
            {
                if (Main.Sol_ControlInfo.CashierMaxAmount < totalSelectedOrders)
                {
                    if (!SolFunctions.PermisosConfirmar("The amount to pay is over the maximum allowed!", "Please provide password for Manager Override.", ""))
                    {
                        //MessageBox.Show("Sorry, you cannot void orders!");
                        return;
                    }
                }
            }


            //busy cursor
            this.Cursor = Cursors.WaitCursor;

            if (BottleDrop && !SaveOrderToBottleDrop())
            {
                return;
            }
            //update orders
            UpdateOrders();
            ordersProcessed = true;

            //print receipt
            //if (!onAccount)   ??? not sure

            if (!Main.Sol_ControlInfo.CashOutPrintingOverride && !BottleDrop)
            {
                string errorMessage = string.Empty;
                bool   flag         = SolFunctions.PrintReceipt(listView1, "", ref errorMessage, Properties.Settings.Default.BarcodeEncoding
                                                                , buttonSource
                                                                , securityCode
                                                                , totalSelectedOrders
                                                                );
                if (!flag)
                {
                    MessageBox.Show("There was a problem printing the receipt, please try again.\nError: " + errorMessage);
                }
            }

            //open drawer
            if (!onAccount)
            {
                //OpenDrawer();
                PrinterCommand.Send(Main.AssemblyProduct, Properties.Settings.Default.SettingsWsReceiptPrinter, Properties.Settings.Default.SettingsWsTicketOpenDrawer);

                //coin dispenser
                if (AxCoinUSB2 != null)
                {
                    //int iDecimalPart = (int)((totalPaidOrders - Math.Truncate(totalPaidOrders)) * 100);
                    //int iIntegerPart = (int)(totalPaidOrders) * 100;
                    //int iTotalPaidOrders = iIntegerPart+iDecimalPart;

                    //Cajero_Automatico.Calculate("ca", totalPaidOrders, ref Main.billsAndCoinsByCountry);
                    decimal totalCoins = 0;
                    decimal totalBills = 0;
                    Cajero_Automatico.Calculate(
                        "CA",
                        totalPaidOrders,
                        //ref Main.billsAndCoinsByCountry,
                        out totalCoins,
                        out totalBills);

                    int iCoins = (int)(totalCoins * 100);

                    if (iCoins > 0)
                    {
                        bool flag = Properties.Settings.Default.CoinDispenserEnabled;
                        if (flag)
                        {
                            switch (Properties.Settings.Default.CoinDispenserDevice)
                            {
                            case 0:     // tflex coin dispenser
                                decimal totalDiference = 0;

                                // We call a subroutine to dispense it.
                                DispenseByAmount(iCoins);

                                //if (iCoins >= AxCoinUSB2.DispenseBelowValue)
                                //{
                                //    totalDiference = totalCoins;
                                //    decimal dispenseBelowValue = (decimal)(AxCoinUSB2.DispenseBelowValue)/100;
                                //    decimal amountDispensed = totalCoins - dispenseBelowValue;
                                //    totalCoins = amountDispensed;
                                //    totalDiference -= totalCoins;
                                //}

                                // Get our status and show the user
                                UpdateCanisterStatus(true, iCoins, totalCoins, totalBills, totalDiference);
                                utilDelay(1);
                                break;

                            default:
                                MessageBox.Show("Invalid coin dispenser selection, please go to settings and fix this");
                                break;
                            }
                        }
                    }
                    else
                    {
                        // Show amount dispensed in the status bar
                        UpdateStatus(String.Format("Total Bills:" + SirLib.Funciones.Indent(18) + "{0,9:$##,##0.00}\r\nTotal Coins dispensed:" + SirLib.Funciones.Indent(1) + "{1,9:$##,##0.00}", totalBills, totalCoins));
                    }
                }
            }

            buttonContinue.Text        = "&Close";
            this.buttonContinue.Click -= new System.EventHandler(this.buttonContinue_Click);
            this.buttonContinue.Click += new System.EventHandler(this.Cancel_Click);
            buttonContinue.BackColor   = Color.FromArgb(241, 116, 85);
            buttonContinue.ForeColor   = SystemColors.Control;

            if (!BottleDrop)
            {
                buttonRePrint.Enabled      = true;
                buttonReOpenDrawer.Enabled = true;
            }
            //buttonViewReceipt.Enabled = false;
            Cancel.Visible = false;

            buttonSelectCustomer.Visible = false;

            this.Cursor = Cursors.Default;
        }
Exemplo n.º 13
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;
        }
Exemplo n.º 14
0
        //private void SelectItems(bool select)
        //{
        //    ListView.ListViewItemCollection Items = listViewBags.Items;
        //    foreach (ListViewItem item in Items)
        //        item.Checked = select;
        //}

        #endregion

        private void buttonMissingBags_Click(object sender, EventArgs e)
        {
            ListView.CheckedListViewItemCollection checkedItems = listViewDrops.CheckedItems;
            if (checkedItems.Count < 1)
            {
                MessageBox.Show("No Drop selected");
                return;
            }

            string strDropId = string.Empty;
            int    orderId   = 0;

            foreach (ListViewItem item in checkedItems)
            {
                strDropId = item.SubItems[0].Text;
                orderId   = 0;
                Int32.TryParse(item.SubItems[4].Text, out orderId);
                break;
            }

            int missingBags = 0;

            List <int> listOfBagsCounted    = new List <int>();
            List <int> listOfBagsNotCounted = new List <int>();

            using (SqlConnection connection = new SqlConnection(Properties.Settings.Default.WsirDbConnectionString))
            {
                string sql = string.Empty;
                using (SqlCommand command = new SqlCommand(sql, connection))
                {
                    connection.Open();
                    sql = @"
                        select [BagID]
                        from [qds_bag] 
                        where [DropID] = @DropId 
                        AND YEAR([DateCounted]) > 1753 
                    ";

                    sql = sql.Replace("@DropId", strDropId);
                    command.CommandText = sql;
                    using (SqlDataReader reader = command.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            listOfBagsCounted.Add((int)reader[0]);
                        }
                    }

                    sql = sql.Replace("> 1753", "= 1753");
                    command.CommandText = sql;
                    using (SqlDataReader reader = command.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            listOfBagsNotCounted.Add((int)reader[0]);
                        }
                    }
                }
            }

            missingBags = listOfBagsNotCounted.Count;

            string m = String.Format("{0} bags from this drop have not been counted yet.  Do you want to complete this order and set the status of the rest of the bags to MISSING?", missingBags);

            if (MessageBox.Show(m, "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) != System.Windows.Forms.DialogResult.Yes)
            {
                return;
            }


            //busy cursor
            this.Cursor = Cursors.WaitCursor;

            SolFunctions.CompleteOrder(
                orderId
                , "Q"
                , ref listOfBagsCounted
                , ref listOfBagsNotCounted
                );

            //Add comment to order
            if (sol_Order_Sp == null)
            {
                sol_Order_Sp = new Sol_Order_Sp(Properties.Settings.Default.WsirDbConnectionString);
            }

            sol_Order = sol_Order_Sp.Select(orderId, "Q");
            if (sol_Order != null)
            {
                sol_Order.Comments += string.Format("Bags Counted: {0} Bags Missing: {1}. ", listOfBagsCounted.Count(), missingBags);
                sol_Order_Sp.Update(sol_Order);
            }

            this.Cursor = Cursors.Default;
            MessageBox.Show("Ready!");

            buttonRefresh.PerformClick();
        }
Exemplo n.º 15
0
        public static bool PrintReceipt(
            ListView listView1
            , string printParam
            , ref string errorMessage
            , int barcodeEncoding
            , string buttonSource
            , string securityCode
            , decimal totalSelectedOrders
            )
        {
            errorMessage = string.Empty;
            try
            {
                //query
                string query =
                    " SELECT " +
                    " sol_OrdersDetail.CategoryID, sol_OrdersDetail.Description, " +
                    " sol_Orders.OrderID, sol_Orders.OrderType, sol_Orders.ComputerName, sol_Orders.Date, ISNULL(c.Name, '') as Name,  sol_Orders.TotalAmount,  sol_Orders.FeeAmount, " +
                    " sol_Fees.FeeDescription, " +
                    "SUM(sol_OrdersDetail.Quantity) AS TotalQuantity, sol_OrdersDetail.Price, SUM(sol_OrdersDetail.Amount) as TotalAmountDetail, " +
                    //"ISNULL(c.Name, '') as Name, " +
                    " u.UserName, " +
                    "sol_Orders.Comments " +
                    "FROM    " +
                    " sol_Orders sol_Orders  " +
                    "LEFT JOIN  sol_Customers as c ON c.[CustomerID] = sol_Orders.[CustomerID] " +
                    "AND sol_Orders.[CustomerID] != 0 " +
                    " INNER JOIN sol_OrdersDetail sol_OrdersDetail  ON (sol_Orders.OrderID = sol_OrdersDetail.OrderID)  " +
                    " INNER JOIN sol_Fees sol_Fees ON (sol_Orders.FeeID = sol_Fees.FeeID) " +
                    " INNER JOIN Sol_Categories Sol_Categories ON (sol_OrdersDetail.CategoryID = Sol_Categories.CategoryID) " +
                    " INNER JOIN Solum.Dbo.aspnet_Users u ON (sol_Orders.UserId = u.UserId) " +
                    "WHERE  ";

                string strBarCode = String.Empty;

                //select orders
                bool flagFirstTime = true;
                ListView.ListViewItemCollection Items = listView1.Items;
                foreach (ListViewItem item in Items)
                {
                    string c       = item.SubItems[0].Text.Trim();
                    int    orderId = 0;
                    try
                    {
                        orderId = Int32.Parse(c);
                    }
                    catch
                    {
                        continue;
                    }

                    c = " OR (sol_Orders.OrderType = '" + item.SubItems[4].Text.Trim() + "' AND  " +
                        "sol_Orders.OrderID =  " + orderId.ToString() + ") ";

                    //if(string.IsNullOrEmpty(strBarCode))
                    strBarCode = orderId.ToString("0000000");
                    //else
                    //    strBarCode = strBarCode + orderId.ToString("0000000") + " ";

                    if (flagFirstTime)
                    {
                        c             = c.Replace("OR", "");
                        flagFirstTime = false;
                    }
                    query += c;
                }

                query +=
                    "GROUP by sol_OrdersDetail.CategoryID, sol_OrdersDetail.Description,  " +
                    "sol_Orders.OrderID, sol_Orders.OrderType, sol_Orders.ComputerName, sol_Orders.Date, c.Name,  sol_Orders.TotalAmount,  sol_Orders.FeeAmount, " +
                    "sol_Fees.FeeDescription, " +
                    "sol_OrdersDetail.Price, u.UserName, " +
                    "sol_Orders.Comments " +
                    "ORDER BY sol_OrdersDetail.Description ";

                //query 2
                string query2         = "";
                string subReportName2 = "";

                //query 3
                string query3         = "";
                string subReportName3 = "";


                //receipt message
                Sol_Message    sol_Message    = new Sol_Message();
                Sol_Message_Sp sol_Message_Sp = new Sol_Message_Sp(Properties.Settings.Default.WsirDbConnectionString);
                sol_Message = sol_Message_Sp.Select(Main.Sol_ControlInfo.ReceiptMessageID);

                CrystalDecisions.CrystalReports.Engine.ReportDocument rp = new Solum.Reports.Receipt2();

                string imagePath     = String.Empty;
                string imagePath2    = String.Empty;
                bool   printComplete = false;

                //0 = Quick Cash Out 1 = Print Chit
                if (printParam.ToLower() == "paynow")
                {
                    printComplete = true;
                }
                else if (Main.Sol_ControlInfo.ReturnButtonExtra == 0 || buttonSource == "Cashier")
                {
                    printComplete = true;
                }
                else
                {
                    //0 = complete 1 = order number only
                    if (Main.Sol_ControlInfo.ChitTicketComplete == 0)
                    {
                        printComplete = true;
                    }

                    if (Main.Sol_ControlInfo.ChitTicketIncludeBarcode)
                    {
                        if (Main.Sol_ControlInfo.IncludeSecurityCode)
                        {
                            strBarCode = strBarCode + Main.SecurityCodeSeparator + securityCode;
                        }

                        //MessageBox.Show(string.Format("barcode = {0} length = {1}", strBarCode, strBarCode.Length));
                        //try
                        //{
                        //    System.IO.File.Delete(Main.temFolder + "\\barCode.bmp");
                        //}
                        //catch { }

                        //generate barcode
                        imagePath    = Main.temFolder + "\\barCode.bmp"; //Barcodes\\
                        errorMessage = string.Empty;
                        SolFunctions.GenerateBarcode(
                            Properties.Settings.Default.BarcodeEncoding
                            , Properties.Settings.Default.BarcodeWidth
                            , Properties.Settings.Default.BarcodeHeight
                            , BarcodeLib.AlignmentPositions.LEFT
                            , System.Drawing.RotateFlipType.RotateNoneFlipNone
                            , BarcodeLib.LabelPositions.BOTTOMLEFT
                            , strBarCode
                            , imagePath
                            , BarcodeLib.SaveTypes.BMP
                            , null
                            , ref errorMessage
                            );
                    }
                }

                if (Main.Sol_ControlInfo.ReceiptAmountBarcode)
                {
                    //generate barcode
                    imagePath2   = Main.temFolder + "\\barCodeAmount.bmp"; //Barcodes\\
                    errorMessage = string.Empty;
                    SolFunctions.GenerateBarcode(
                        Properties.Settings.Default.BarcodeEncoding
                        , Properties.Settings.Default.BarcodeWidth
                        , Properties.Settings.Default.BarcodeHeight
                        , BarcodeLib.AlignmentPositions.LEFT
                        , System.Drawing.RotateFlipType.RotateNoneFlipNone
                        , BarcodeLib.LabelPositions.BOTTOMLEFT
                        , totalSelectedOrders.ToString()
                        , imagePath2
                        , BarcodeLib.SaveTypes.BMP
                        , null
                        , ref errorMessage
                        );
                }

                object[,] parametros = new object[, ] {
                    { "1_BusinessName", Main.Sol_ControlInfo.BusinessName },
                    { "2_StoreNumber", Main.Sol_ControlInfo.StoreNumber.ToString() },
                    { "3_Address", Main.Sol_ControlInfo.Address },
                    { "4_City", Main.Sol_ControlInfo.City },
                    { "5_State", Main.Sol_ControlInfo.State },
                    { "6_PhoneNumber", Main.Sol_ControlInfo.PhoneNumber },
                    { "7_Message", sol_Message.Description },
                    { "8_Print", printParam },
                    { "9_PrintComplete", printComplete },
                    { "imagenPath", imagePath },
                    { "email", Main.Sol_ControlInfo.EmailAccount },
                    { "imagenPath2", imagePath2 },
                    { "", "" }
                };

                bool  imprimirReporte = false;
                bool  exportarReporte = false;
                short fileFormat      = 0;          // 0 = rtf 1 = pdf 2 = word 3 = excel
                bool  preverReporte   = false;
                short numeroDeCopias  = 1;
                if (Properties.Settings.Default.SettingsWsReceiptPrintPreview)
                {
                    preverReporte = true;
                }
                else
                {
                    imprimirReporte = true;
                }

                ReportesPrevista f1 = new ReportesPrevista(
                    Properties.Settings.Default.WsirDbConnectionString,
                    Properties.Settings.Default.SQLServidorNombre,
                    Properties.Settings.Default.SQLBaseDeDatos,
                    Properties.Settings.Default.SQLAutentificacion,
                    Properties.Settings.Default.SQLUsuarioNombre,
                    Properties.Settings.Default.SQLUsuarioClave,
                    rp,
                    query,
                    query2,
                    query3,
                    parametros,
                    subReportName2,
                    subReportName3,
                    Properties.Settings.Default.SettingsWsReceiptPrinter.Trim(),
                    fileFormat,
                    String.Empty,
                    numeroDeCopias,
                    exportarReporte,
                    imprimirReporte,
                    preverReporte,
                    null,
                    String.Empty,
                    true,
                    true
                    );

                f1.ShowDialog();
                f1.Dispose();
                f1 = null;
            }
            catch (Exception ex)
            {
                errorMessage = ex.Message;
                return(false);
            }

            return(true);
        }
Exemplo n.º 16
0
        private void comboBoxProducts_SelectedIndexChanged(object sender, EventArgs e)
        {
            int Id = -1;

            try
            {
                Id = (int)comboBoxProducts.SelectedValue;
            }
            catch
            {
                return;
            }


            //delete row if it was new
            if (sol_Agency != null)
            {
                if (sol_Agency.AutoGenerateTagNumber)
                {
                    if (buttonClicked == "&New")
                    {
                        DeleteStagedRow();
                    }
                }
            }

            //Sol_Product sol_Product = new Sol_Product();
            if (sol_Product_Sp == null)
            {
                sol_Product_Sp = new Sol_Product_Sp(Properties.Settings.Default.WsirDbConnectionString);
            }
            sol_Product = sol_Product_Sp.Select(Id);

            comboBoxContainers.SelectedValue = sol_Product.ContainerID;


            //open table connection
            if (sol_Agency_Sp == null)
            {
                sol_Agency_Sp = new Sol_Agencie_Sp(Properties.Settings.Default.WsirDbConnectionString);
            }
            sol_Agency = sol_Agency_Sp.Select(sol_Product.AgencyID);
            //if (sol_Agency != null)
            //{
            //    Int32.TryParse(sol_Agency.VendorID, out intValue);
            //    vendorId = intValue.ToString("0000");
            //}


            if (sol_Agency.AutoGenerateTagNumber)
            {
                //add row
                if (AddStagedRow())
                {
                    textBoxTagNumber.Text     = sol_Stage.TagNumber;
                    textBoxTagNumber.ReadOnly = true;
                    comboBoxContainers.Focus();
                    comboBoxProducts.Enabled = false;
                }
                else
                {
                    buttonCancel.PerformClick();
                }
            }
            else
            {
                textBoxTagNumber.ReadOnly = false;
                //textBoxTagNumber.Focus();
            }

            //Sol_StandardDozen_Sp sol_StandardDozen_Sp = new Sol_StandardDozen_Sp(Properties.Settings.Default.WsirDbConnectionString);
            //Sol_StandardDozen sol_StandardDozen = sol_StandardDozen_Sp.Select(sol_Product.StandardDozenID);
            //textBoxDefaultDozen.Text = sol_StandardDozen.Quantity.ToString();

            textBoxQuantity.Text = sol_Product.TargetQuantity.ToString();
            textBoxDozen.Text    = SolFunctions.Quantity2Dozen(sol_Product.TargetQuantity);
        }
Exemplo n.º 17
0
        private void CustomerOrdersPayNow_Load(object sender, EventArgs e)
        {
            // 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);
            if (Properties.Settings.Default.TouchOriented)
            {
                //this.Height = this.Height + (OK.Height) + 150;
                //OK.Height = OK.Height * 2;
                //buttonSelectAll.Height = buttonSelectAll.Height * 2;
                //buttonRefresh.Height = buttonRefresh.Height * 2;
                //Cancel.Height = Cancel.Height * 2;
                this.radioButtonCheckNumber.Font = new System.Drawing.Font("Microsoft Sans Serif", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                this.textBoxCheckNumber.Font     = new System.Drawing.Font("Microsoft Sans Serif", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                this.radioButtonCashTray.Font    = new System.Drawing.Font("Microsoft Sans Serif", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                this.comboBoxCashTray.Font       = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                this.textBoxReference.Font       = new System.Drawing.Font("Microsoft Sans Serif", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));


                toolStripButtonVirtualKb.Visible = true;
                //this.CenterToParent();
            }

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

            //check cashier is open
            radioButtonCashTray.Enabled = SolFunctions.CheckCashier();
            comboBoxCashTray.Enabled    = radioButtonCashTray.Enabled;

            radioButtonCheckNumber.Checked = true;

            //listview with headers
            listView1.View = View.Details;
            listView1.Columns.Add("Order #", 80, HorizontalAlignment.Center);
            listView1.Columns.Add("Amount", 75, HorizontalAlignment.Center);
            listView1.Columns.Add("", 0, HorizontalAlignment.Center);
            listView1.Columns.Add("", 0, HorizontalAlignment.Center);
            listView1.Columns.Add("Type", 60, HorizontalAlignment.Center);
            listView1.Columns.Add("Fee", 75, HorizontalAlignment.Center);

            DisplayOrders();

            if (paymentType == 0)    //cash
            {
                radioButtonCheckNumber.Enabled = false;
                radioButtonCheckNumber.Checked = false;
                textBoxCheckNumber.Enabled     = false;

                radioButtonCashTray.Enabled = true;
                radioButtonCashTray.Checked = true;
                comboBoxCashTray.Enabled    = true;
                textBoxReference.Enabled    = true;
            }
            else if (paymentType == 1)    // check
            {
                radioButtonCheckNumber.Enabled = true;
                radioButtonCheckNumber.Checked = true;
                textBoxCheckNumber.Enabled     = true;

                radioButtonCashTray.Enabled = false;
                radioButtonCashTray.Checked = false;
                comboBoxCashTray.Enabled    = false;
                textBoxReference.Enabled    = false;
            }
        }