Пример #1
0
        private void UpdatePosition()
        {
            Form_Login formLogin = new Form_Login(string.Format("Verificación De\nUsuario"));
            DarkForm   darkForm  = new DarkForm();

            if (this.employee.ID != 1)
            {
                darkForm.Show();
                int      num1     = (int)formLogin.ShowDialog();
                Empleado empleado = new Empleado(formLogin.ID);
                if (formLogin.DialogResult == DialogResult.OK && empleado.isAdmin)
                {
                    this.employee.UpdatePosition(this.comboBox1.SelectedIndex == 1);
                    int num2 = (int)MessageBox.Show("Se ha actualizado el puesto del empleado");
                }
                else if (formLogin.DialogResult == DialogResult.OK && !empleado.isAdmin && formLogin.ID > -1)
                {
                    int num2 = (int)MessageBox.Show("No tiene los permisos necesarios para realizar esta acción");
                    this.changingEmployee        = true;
                    this.comboBox1.SelectedIndex = this.employee.isAdmin ? 1 : 0;
                    this.changingEmployee        = false;
                }
                else
                {
                    this.changingEmployee        = true;
                    this.comboBox1.SelectedIndex = this.employee.isAdmin ? 1 : 0;
                    this.changingEmployee        = false;
                }
                darkForm.Close();
            }
            else
            {
                int num = (int)MessageBox.Show("No puede dejar de ser administrador");
            }
        }
Пример #2
0
        private void StatisticsProductTxt_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode != System.Windows.Forms.Keys.Return || !(this.StatisticsProductTxt.Text != ""))
            {
                return;
            }
            DataTable table = Producto.SearchValueGetTable(this.StatisticsProductTxt.Text);

            if (table.Rows.Count == 1)
            {
                this.product = new Producto(table.Rows[0]["Código de Barras"].ToString());
                this.ProductStatistics();
                this.StatisticsProductTxt.Text    = "";
                statisticsProductsProductLbl.Text = string.Format("{0}, {1}", product.Description, product.Brand);
            }
            else if (table.Rows.Count > 1)
            {
                DarkForm          darkForm          = new DarkForm();
                ChooseProductForm chooseProductForm = new ChooseProductForm(table);
                darkForm.Show();
                if (chooseProductForm.ShowDialog() == DialogResult.OK)
                {
                    this.product = new Producto(chooseProductForm.selectedItem[0]);
                    this.ProductStatistics();
                    this.StatisticsProductTxt.Text    = "";
                    statisticsProductsProductLbl.Text = string.Format("{0}, {1}", product.Description, product.Brand);
                }
                darkForm.Close();
            }
            else
            {
                int num = (int)MessageBox.Show("No se encontró el producto.");
                this.StatisticsProductTxt.SelectAll();
            }
        }
Пример #3
0
        private void UpdateSalary()
        {
            double     newSalary = Convert.ToDouble(this.salaryTxt.Text);
            Form_Login formLogin = new Form_Login(string.Format("Verificación De\nUsuario"));
            DarkForm   darkForm  = new DarkForm();

            if (this.employee.salary == newSalary)
            {
                return;
            }
            darkForm.Show();
            int      num1     = (int)formLogin.ShowDialog();
            Empleado empleado = new Empleado(formLogin.ID);

            if (formLogin.DialogResult == DialogResult.OK && empleado.isAdmin)
            {
                this.employee.updateSalary(newSalary);
                int num2 = (int)MessageBox.Show("Se ha actualizado el número el salario");
                this.salaryTxt.Text = newSalary.ToString("n2");
            }
            else if (formLogin.DialogResult == DialogResult.OK && !empleado.isAdmin && formLogin.ID > -1)
            {
                int num2 = (int)MessageBox.Show("No tiene los permisos necesarios para realizar esta acción");
                this.salaryTxt.Text = this.employee.salary.ToString("n2");
            }
            else
            {
                this.salaryTxt.Text = this.employee.salary.ToString("n2");
            }
            darkForm.Close();
        }
Пример #4
0
        private void searchEmployee()
        {
            if (!(this.searchEmployeeTxt.Text != ""))
            {
                return;
            }
            DataTable employeeList = Empleado.searchEmployee(this.searchEmployeeTxt.Text);
            PanelEmpleados_SelectEmployee empleadosSelectEmployee = new PanelEmpleados_SelectEmployee(employeeList);
            DarkForm darkForm = new DarkForm();

            if (employeeList.Rows.Count == 0)
            {
                MessageBox.Show("No se encontraron empleados");
            }
            else if (employeeList.Rows.Count == 1)
            {
                this.employee = new Empleado(Convert.ToInt32(employeeList.Rows[0]["id_Empleado"]));
                this.setEmployeeInfo();
            }
            else
            {
                darkForm.Show();
                if (empleadosSelectEmployee.ShowDialog() == DialogResult.OK)
                {
                    this.employee = new Empleado(empleadosSelectEmployee.employeeID);
                    this.setEmployeeInfo();
                }
                darkForm.Close();
            }

            employeeList.Dispose();
            empleadosSelectEmployee.Dispose();
        }
Пример #5
0
        private void employeeList_Click(object sender, EventArgs e)
        {
            DataTable listOfEmployees = Empleado.getListOfEmployees();
            PanelEmpleados_SelectEmployee empleadosSelectEmployee = new PanelEmpleados_SelectEmployee(listOfEmployees);
            DarkForm darkForm = new DarkForm();

            if (listOfEmployees.Rows.Count == 0)
            {
                int num = (int)MessageBox.Show("No se encontraron empleados");
            }
            else if (listOfEmployees.Rows.Count == 1)
            {
                this.employee = new Empleado(Convert.ToInt32(listOfEmployees.Rows[0]["id_Empleado"]));
                this.setEmployeeInfo();
            }
            else
            {
                darkForm.Show();
                if (empleadosSelectEmployee.ShowDialog() == DialogResult.OK)
                {
                    this.employee = new Empleado(empleadosSelectEmployee.employeeID);
                    this.setEmployeeInfo();
                }
                darkForm.Close();
            }
        }
Пример #6
0
        private void changePassBtn_Click(object sender, EventArgs e)
        {
            Form_Change_Password formChangePassword = new Form_Change_Password(this.employee.ID, true);
            DarkForm             darkForm           = new DarkForm();

            darkForm.Show();
            formChangePassword.ShowDialog();
            darkForm.Hide();
        }
Пример #7
0
        private void ConfirmBtn_Click(object sender, EventArgs e)
        {
            dataGridView1.EndEdit();
            foreach (DataGridViewRow row in this.dataGridView1.Rows)
            {
                if (row.DefaultCellStyle.ForeColor.ToKnownColor() == Color.FromArgb(0, 0, 0, 0).ToKnownColor())
                {
                    MessageBox.Show("Aún quedan artículos sin revisar");
                    dataGridView1.CurrentCell = row.Cells["Cantidad"];
                    dataGridView1.BeginEdit(true);
                    return;
                }
            }
            Form_Login formLogin = new Form_Login(string.Format("Verificación De\nUsuario"));
            DarkForm   darkForm  = new DarkForm();

            darkForm.Show();
            if (formLogin.ShowDialog() == DialogResult.OK)
            {
                foreach (DataGridViewRow row in this.dataGridView1.Rows)
                {
                    if (row.DefaultCellStyle.ForeColor == Color.LimeGreen || row.DefaultCellStyle.ForeColor == Color.Tomato)
                    {
                        int correspondingIndex = this.getCorrespondingIndex(row.Index);
                        if (correspondingIndex > -1 && row.Cells["Cantidad"].Value != this.PO._products.Rows[correspondingIndex]["Cantidad"])
                        {
                            Producto producto = new Producto(row.Cells["Código de Barras"].Value.ToString());

                            double num = (Convert.ToDouble(row.Cells["Cantidad"].Value) - Convert.ToDouble(this.PO._products.Rows[correspondingIndex]["Cantidad"])) * Convert.ToDouble(row.Cells["Piezas por Caja"].Value);

                            if (num != 0.0)
                            {
                                Bodega depot = new Bodega(producto.defaultDepotID);
                                depot.UpdateProductQuantity(depot.getProductQuantity(producto.Barcode) + num, producto.Barcode);
                                this.PO.UpdateProductQunantity(producto.Barcode, Convert.ToDouble(row.Cells["Cantidad"].Value));
                            }
                        }
                    }
                }

                this.PO.delivered = true;
                this.PO._EmployeeWhoConfirmedThePurchaseID = formLogin.ID;
                this.PO.updateDeliveryStatus();
                this.updateValues();
                this.PO = new OrdenCompra(this.PO.ID);

                if (inASearch)
                {
                    searchPO();
                }
                else
                {
                    this.loadPurchases();
                }
            }
            darkForm.Close();
        }
        private void EditPromo()
        {
            DarkForm darkForm = new DarkForm();
            PanelProveedoresPromosAddEdit proveedoresPromosAddEdit = new PanelProveedoresPromosAddEdit(this.proveedor, new Oferta(int.Parse(this.PromoGridView.SelectedRows[0].Cells[0].Value.ToString())));

            darkForm.Show();
            if (proveedoresPromosAddEdit.ShowDialog() == DialogResult.OK)
            {
                this.loadPromos();
            }
            darkForm.Close();
        }
Пример #9
0
        private void editDepot(int columnIndex)
        {
            PanelProductos_NuevaBodega productosNuevaBodega = new PanelProductos_NuevaBodega(Convert.ToInt32(this.dataGridView1.Columns[columnIndex].Name));
            DarkForm darkForm = new DarkForm();

            darkForm.Show();
            if (productosNuevaBodega.ShowDialog() == DialogResult.OK)
            {
                this.dataGridView1.DataSource = Bodega.getInventory(SearchTxt.Text);
                this.FitTableInformation();
                this.dataGridView1.CurrentCell = this.dataGridView1.RowCount > 0 ? this.dataGridView1.Rows[this.selectedrow].Cells[0] : (DataGridViewCell)null;
            }
            darkForm.Close();
        }
Пример #10
0
        private void DataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            DataRow  discount1 = this.cliente.findDiscount(Convert.ToInt32(this.DataGridView1.CurrentRow.Cells["id_descuento"].Value));
            DarkForm darkForm  = new DarkForm();
            string   discount2 = Convert.ToBoolean(discount1["Porcentage"]) ? Convert.ToDouble(discount1["Descuento"]).ToString("n2") + "%" : Convert.ToDouble(discount1["Descuento"]).ToString("n2");
            FormAgregarPrecioCliente agregarPrecioCliente = new FormAgregarPrecioCliente(this.CustomerID, discount1["id_producto"].ToString(), Convert.ToDouble(discount1["Cantidad minima"]), discount2, Convert.ToBoolean(discount1["Venta por Caja"]), Convert.ToInt32(discount1["id_descuento"]));

            darkForm.Show();
            if (agregarPrecioCliente.ShowDialog() == DialogResult.OK)
            {
                this.fillGridView();
            }
            darkForm.Close();
        }
Пример #11
0
        private void NuevoBtn_Click_1(object sender, EventArgs e)
        {
            FormAgregarPrecioCliente agregarPrecioCliente = new FormAgregarPrecioCliente(this.CustomerID);
            DarkForm darkForm = new DarkForm();

            darkForm.Show();
            switch (agregarPrecioCliente.ShowDialog())
            {
            case DialogResult.OK:
            case DialogResult.Yes:
                this.fillGridView();
                break;
            }
            darkForm.Close();
        }
Пример #12
0
        private void startNewShift()
        {
            FormNewShift formNewShift = new FormNewShift(new Empleado(this.employeeID).isAdmin);
            DarkForm     darkForm     = new DarkForm();

            darkForm.Show();
            if (formNewShift.ShowDialog() == DialogResult.OK)
            {
                Turno.start(DateTime.Now, formNewShift.Cash, this.employeeID);
                this.startShiftBtn.Hide();
                this.button2.Hide();
                endShiftBtn.Enabled = this.endShiftBtn.Visible = new Empleado(employeeID).isAdmin;
                this.setGroupBoxInfo();
            }
            darkForm.Close();
        }
Пример #13
0
        private void newEmployeeBtn_Click(object sender, EventArgs e)
        {
            if (!new Empleado(this.User_employeeID).isAdmin)
            {
                return;
            }
            panelEmpleados_nuevoEmpleado empleadosNuevoEmpleado = new panelEmpleados_nuevoEmpleado(true);
            DarkForm darkForm = new DarkForm();

            darkForm.Show();
            if (empleadosNuevoEmpleado.ShowDialog() == DialogResult.OK)
            {
                this.employee = new Empleado(empleadosNuevoEmpleado.newEmployeeID);
                this.setEmployeeInfo();
            }
            darkForm.Close();
        }
Пример #14
0
        private void changeUserBtn_Click(object sender, EventArgs e)
        {
            Form_Login formLogin = new Form_Login("Iniciar Sesión");
            DarkForm   darkForm  = new DarkForm();

            if (MessageBox.Show(string.Format("¿Desea cambiar de usuario?.\nGuarde su información antes de continuar."), "", MessageBoxButtons.YesNo) != DialogResult.Yes)
            {
                return;
            }
            darkForm.Show();

            if (formLogin.ShowDialog() == DialogResult.OK)
            {
                employee = new Empleado(formLogin.ID);
                displayHideTabs();

                homeBtn.BackColor = homeBtn.Parent.BackColor;//changing color to load home panel
                homeBtn_Click((object)this, (EventArgs)null);

                try { (ContainerPanel.Controls[0] as Panel_Inicio).EmployeeID = employee.ID; }
                catch (Exception) { }

                var count = Application.OpenForms.Count;
                for (int i = 0; i < count; i++)
                {
                    var item = Application.OpenForms[i];


                    if (item.GetType() == typeof(Panel_Ventas))
                    {
                        (item as Panel_Ventas).setEmployee(employee.ID);
                    }
                    if (item.GetType() == typeof(Panel_Productos))
                    {
                        (item as Panel_Productos).setEmployee(employee.ID);

                        if (count > Application.OpenForms.Count)
                        {
                            i--;
                            count = Application.OpenForms.Count;
                        }
                    }
                }
            }
            darkForm.Close();
        }
Пример #15
0
        private void updatePromoBtn_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("¿Desea actualizar los datos?", "Actualizar Promoción", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                DarkForm dk = new DarkForm();
                panel_productos_productPromos_cost costForm = new panel_productos_productPromos_cost(
                    Convert.ToDouble(dataGridView1.CurrentRow.Cells["costo"].Value));
                dk.Show();
                if (costForm.ShowDialog() == DialogResult.OK)
                {
                    Producto.updatePromo(currentPromoID, getListOfProducts(), costForm.cost);
                    populateTable();
                    showGridHideTable();

                    MessageBox.Show("Se acutalizó la información");
                }
            }
        }
Пример #16
0
        private void addBtn_Click(object sender, EventArgs e)
        {
            formAgregar_VentaSurtido_AgregarAGrupo addNewProduct = new formAgregar_VentaSurtido_AgregarAGrupo();
            DarkForm dk = new DarkForm();

            dk.Show();

            if (addNewProduct.ShowDialog() == DialogResult.OK)
            {
                //looking for repeated products
                foreach (DataGridViewRow row in dataGridView1.Rows)
                {
                    if (row.Cells["barcode"].Value.ToString() == addNewProduct.barcode)
                    {
                        MessageBox.Show("No se puede agregar el mismo producto nuevamente");
                        dk.Close();
                        return;
                    }
                }

                Producto p = new Producto(addNewProduct.barcode);

                //looking for diffent costs and amounts
                if (!validateProduct(p))
                {
                    dk.Close();
                    return;
                }
                if (p.Barcode != "")
                {
                    if (p.mixedCaseGroup == 0)
                    {
                        dataGridView1.Rows.Add(p.Barcode, string.Format("{0}, \r\n{1}", p.Description, p.Brand));
                        dataGridView1.CurrentCell = dataGridView1.Rows[dataGridView1.RowCount - 1].Cells[1];
                    }
                    else
                    {
                        lookForAGroup(p.mixedCaseGroup);
                    }
                }
            }
            dk.Close();
        }
Пример #17
0
        private void saveBtn_Click(object sender, EventArgs e)
        {
            if (tableLayoutPanel1.RowCount == 1)
            {
                return;
            }
            DarkForm dk = new DarkForm();
            panel_productos_productPromos_cost costForm = new panel_productos_productPromos_cost();

            dk.Show();
            if (costForm.ShowDialog() == DialogResult.OK)
            {
                Producto.newPromo(getListOfProducts(), costForm.cost);
                populateTable();
                showGridHideTable();
            }

            dk.Close();
        }
Пример #18
0
        private void AddRowBtn_Click(object sender, EventArgs e)
        {
            AutoCompleteStringCollection barcodes     = new AutoCompleteStringCollection();
            AutoCompleteStringCollection descriptions = new AutoCompleteStringCollection();

            foreach (DataRow row in (InternalDataCollectionBase)Producto.fillTable().Rows)
            {
                barcodes.Add(row["Código de Barras"].ToString());
                descriptions.Add(row["Descripción"].ToString().ToLower());
            }
            PanelProveedoresPromosAddEdit proveedoresPromosAddEdit = new PanelProveedoresPromosAddEdit(this.proveedor, barcodes, descriptions);
            DarkForm darkForm = new DarkForm();

            darkForm.Show();
            if (proveedoresPromosAddEdit.ShowDialog() == DialogResult.OK)
            {
                this.loadPromos();
            }
            darkForm.Close();
        }
Пример #19
0
        private void t_Tick(object sender, EventArgs e)
        {
            Form_Login           formLogin            = new Form_Login("Iniciar Sesión");
            SecondStartingWindow secondStartingWindow = new SecondStartingWindow();

            (sender as Timer).Stop();
            this.TopMost = false;
            if (Turno.isFirsUsageDateSet)
            {
                if (formLogin.ShowDialog() == DialogResult.OK)
                {
                    this.Hide();
                    new Form1(formLogin.ID).Show();
                }
                else
                {
                    this.Close();
                }
            }
            else
            {
                DarkForm darkForm = new DarkForm();
                panelEmpleados_nuevoEmpleado empleadosNuevoEmpleado = new panelEmpleados_nuevoEmpleado(false);
                this.Hide();
                darkForm.Show();
                if (empleadosNuevoEmpleado.ShowDialog() == DialogResult.OK)
                {
                    resetDefaultFonts();
                    if (secondStartingWindow.ShowDialog() == DialogResult.OK)
                    {
                        new Form1(empleadosNuevoEmpleado.newEmployeeID).Show();
                    }
                }
                else
                {
                    this.Close();
                }
                darkForm.Close();
            }
        }
Пример #20
0
        private void addProductToRow(object sender, EventArgs e)
        {
            var control     = sender as Control;
            int rowIndex    = Convert.ToInt32(control.Name.Substring(control.Name.IndexOf("_") + 1));
            var productText = (tableLayoutPanel1.GetControlFromPosition(1, rowIndex) as TextBox);
            var barcode     = tableLayoutPanel1.GetControlFromPosition(1, rowIndex).Text.Trim();
            var amount      = tableLayoutPanel1.GetControlFromPosition(2, rowIndex).Text.Trim();

            if (barcode == "" || amount == "")
            {
                return;
            }
            if (checkForDuplicates(barcode))
            {
                MessageBox.Show("Ya se encuentra este producto en la lista.");
                return;
            }

            Producto p = isNumber(barcode) && Producto.SearchProduct(barcode) ? new Producto(barcode) : null;

            if (p == null)
            {
                DataTable dt = Producto.SearchValueGetTable(barcode);

                if (dt.Rows.Count == 0)
                {
                    MessageBox.Show("No se encontró el producto");
                    productText.Focus();
                    productText.SelectAll();
                    return;
                }
                else if (dt.Rows.Count == 1)
                {
                    p = new Producto(dt.Rows[0]["Código de Barras"].ToString());
                }
                else
                {
                    ChooseProductForm choose = new ChooseProductForm(dt);
                    DarkForm          dk     = new DarkForm();

                    dk.Show();
                    if (choose.ShowDialog() == DialogResult.OK)
                    {
                        p = new Producto(choose.selectedItem[0]);
                    }
                    else
                    {
                        return;
                    }
                }
            }

            productText.Name = p.Barcode + "_" + rowIndex.ToString();
            productText.Dock = DockStyle.Fill;

            var amountTxt = tableLayoutPanel1.GetControlFromPosition(2, rowIndex) as TextBox;

            try { double d = Convert.ToDouble(amount); }
            catch (FormatException)
            {
                MessageBox.Show("La Cantidad no tiene el formato adecuado");
                amountTxt.Focus();
                amountTxt.SelectAll();
                return;
            }

            amountTxt.Enabled = false;
            amountTxt.Dock    = DockStyle.Fill;

            productText.Enabled = false;
            productText.Text    = string.Format("{0}, {1}", p.Description, p.Brand);

            tableLayoutPanel1.Controls.RemoveByKey("addProduct_" + rowIndex.ToString());

            tableLayoutPanel1.Controls.Add(new Bunifu.Framework.UI.BunifuImageButton()
            {
                BackColor = Color.Transparent,
                Image     = Properties.Resources.close,
                Size      = new Size(25, 25),
                Anchor    = AnchorStyles.None,
                Name      = "removeProductBtn_" + rowIndex.ToString()
            }, 0, rowIndex);;

            var removeBtn = tableLayoutPanel1.GetControlFromPosition(0, rowIndex) as Bunifu.Framework.UI.BunifuImageButton;

            removeBtn.Click += new EventHandler(removeBtn_click);
            newRow();
        }
Пример #21
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (!Turno.shiftActive)
            {
                return;
            }
            DarkForm          darkForm          = new DarkForm();
            Form_Login        formLogin         = new Form_Login(string.Format("Verificación De\nUsuario"));
            FormShiftAddMoney formShiftAddMoney = new FormShiftAddMoney();

            darkForm.Show();
            formLogin.ShowDialog();

            Empleado empleado = new Empleado(formLogin.ID);


            if (formLogin.DialogResult == DialogResult.OK && empleado.isAdmin)
            {
                if (formShiftAddMoney.ShowDialog() == DialogResult.OK)
                {
                    //<<< step1 >>> --Start
                    //When outputting to a printer,a mouse cursor becomes like a hourglass.


                    try
                    {
                        if (m_Drawer != null)
                        {
                            //Open the device
                            //Use a Logical Device Name which has been set on the SetupPOS.
                            m_Drawer.Open();

                            //Get the exclusive control right for the opened device.
                            //Then the device is disable from other application.
                            m_Drawer.Claim(1000);

                            //Enable the device.
                            m_Drawer.DeviceEnabled = true;
                            //Open the drawer by using the "OpenDrawer" method.
                            m_Drawer.OpenDrawer();


                            m_Drawer.DeviceEnabled = false;
                            m_Drawer.Release();
                            m_Drawer.Close();
                        }
                        else
                        {
                            useDefaultPrinter();
                        }
                    }
                    catch (Exception)
                    {
                        if (m_Drawer != null)
                        {
                            m_Drawer.Release();
                            m_Drawer.Close();
                        }
                        useDefaultPrinter();
                    }
                    //<<<step1>>>--End

                    Turno.AddCashToDrawer(empleado.ID, formShiftAddMoney.cash, formShiftAddMoney.reason);
                    MessageBox.Show("Se realizó correctamente");
                    this.setGroupBoxInfo();
                }
            }
            else if (formLogin.DialogResult == DialogResult.OK && !empleado.isAdmin && formLogin.ID > -1)
            {
                MessageBox.Show("No tiene los permisos necesarios para realizar esta acción");
            }
            darkForm.Close();
        }
Пример #22
0
        private async void endShiftBtn_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("¿Desea hacer el corte de caja?", "Corte de caja", MessageBoxButtons.YesNo) != DialogResult.Yes)
            {
                return;
            }
            endShiftBtn.Enabled = false;
            button1.Enabled     = false;
            this.Cursor         = Cursors.WaitCursor;

            DataTable dt = await Task.Run(() => Turno.endShift(this.employeeID));

            this.printDocument1            = new PrintDocument();
            printDocument1.PrintController = new StandardPrintController();

            this.printDocument1.PrintPage += (ss, ee) =>
            {
                DataRow       row           = dt.Rows[0];
                PrinterTicket printerTicket = new PrinterTicket();

                this.printDocument1.PrinterSettings.PrinterName = printerTicket.printerName;

                Graphics graphics = ee.Graphics;
                graphics.PixelOffsetMode = PixelOffsetMode.HighQuality;

                int width = (int)this.printDialog1.PrinterSettings.DefaultPageSettings.PrintableArea.Width; //this.printDocument1.DefaultPageSettings.PaperSize.Width;
                int y     = 0;
                if (printerTicket.logoDisplay && printerTicket.logo != null)
                {
                    Bitmap bitmap = printerTicket.logo != null ? new Bitmap(printerTicket.logo, width, printerTicket.logoHeight) : (Bitmap)null;
                    bitmap.SetResolution((float)width, (float)printerTicket.logoHeight);
                    graphics.DrawImage((Image)bitmap, 0, y, width, printerTicket.logoHeight);
                    y += printerTicket.logoHeight + 10;
                }
                if (printerTicket.headderDisplay)
                {
                    y += printingClass.printLine(printerTicket.header, printerTicket.headerFont,
                                                 width, StringAlignment.Center, graphics, y) + 1;
                }
                string str  = "Corte de Caja";
                Font   font = new Font("times new roman", 18f, FontStyle.Bold);
                y += printingClass.printLine(str, font, width, StringAlignment.Center, graphics, y) + 1;

                var startingTime = Turno.startingDate;
                str = string.Format("Periodo del Turno: {0} {1} - {2} {3}", startingTime.Date.ToShortDateString(), startingTime.ToShortTimeString(),
                                    DateTime.Now.Date.ToShortDateString(), DateTime.Now.ToShortTimeString());

                font = width > 200 ? new Font("Times new Roman", 9.9f, FontStyle.Bold) : new Font("Times new Roman", 7f, FontStyle.Bold);
                y   += printingClass.printLine(str, font, width, StringAlignment.Near, graphics, y) + 3;

                str = "Comenzó el turno: " + new Empleado(Convert.ToInt32(row["Empleado que Inició"])).name;
                y  += printingClass.printLine(str, font, width, StringAlignment.Near, graphics, y) + 1;

                str = "Realizó corte de caja: " + new Empleado(this.employeeID).name;
                y  += printingClass.printLine(str, font, width, StringAlignment.Near, graphics, y) + 15;


                for (int index = 0; index < 9; ++index)
                {
                    font = width > 200 ? new Font("Times new Roman", 9.9f) : new Font("Times new Roman", 7f);
                    str  = dt.Columns[index].ColumnName;
                    y   += printingClass.printLine(str, font, width, StringAlignment.Near, graphics, y) + 1;

                    font = width > 200 ? new Font("Times new Roman", 9.9f, FontStyle.Bold) : new Font("Times new Roman", 7f, FontStyle.Bold);
                    str  = row[index].ToString();
                    str  = index > 0 ? str.Substring(1) : str;
                    str  = Convert.ToDouble(str) > 0.0 ? string.Format("{0}", row[index]) :
                           string.Format("{0}", row[index]);
                    y += printingClass.printLine(str, font, width, StringAlignment.Near, graphics, y) + 5;
                }
            };

            this.endShiftBtn.Hide();
            this.button2.Show();
            DarkForm darkForm = new DarkForm();
            panelInicio_finDeTurno inicioFinDeTurno = new panelInicio_finDeTurno(Convert.ToDouble(dt.Rows[0]["Efectivo a Entregar"].ToString().Substring(1)));

            darkForm.Show();
            try
            {
                this.printDocument1.PrinterSettings.PrinterName = this.printDialog1.PrinterSettings.PrinterName;
                this.printDialog1.Document = this.printDocument1;
                this.printDocument1.Print();
            }
            catch (InvalidPrinterException)
            {
                MessageBox.Show("Registre una impresora para poder utilizar esta opción", "No se ha registrado impresora");
            }
            inicioFinDeTurno.ShowDialog();

            darkForm.Close();

            this.Cursor = Cursors.Default;
        }
Пример #23
0
 private void ProductTxt_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode != Keys.Return || !(this.ProductTxt.Text != ""))
     {
         return;
     }
     if (!this.isNumber(this.ProductTxt.Text))
     {
         DataTable table = Producto.SearchValueGetTable(this.ProductTxt.Text);
         if (table.Rows.Count == 0)
         {
             MessageBox.Show("No se encontró el producto", "Sin coincidencias", MessageBoxButtons.OK);
         }
         else if (table.Rows.Count == 1)
         {
             this.product = new Producto(table.Rows[0]["Código de Barras"].ToString());
             this.setReceiverDepotCard();
             if (this.donatingDepot == null || this.receiverDepot == null)
             {
                 return;
             }
             this.transferCount = 0;
             this.setDonatingDepotCard();
             textBox1.Select();
         }
         else
         {
             DarkForm          darkForm          = new DarkForm();
             ChooseProductForm chooseProductForm = new ChooseProductForm(table);
             darkForm.Show();
             if (chooseProductForm.ShowDialog() == DialogResult.OK)
             {
                 this.product = new Producto(chooseProductForm.selectedItem[0]);
                 this.setReceiverDepotCard();
                 if (this.donatingDepot != null && this.receiverDepot != null)
                 {
                     this.transferCount = 0;
                     this.setDonatingDepotCard();
                 }
                 textBox1.Select();
             }
             darkForm.Close();
         }
     }
     else
     {
         Producto producto = new Producto(this.ProductTxt.Text);
         if (producto.Description == null)
         {
             MessageBox.Show("No se encontró el producto", "Sin coincidencias", MessageBoxButtons.OK);
         }
         else
         {
             this.product = producto;
             this.setReceiverDepotCard();
             if (this.donatingDepot == null || this.receiverDepot == null)
             {
                 return;
             }
             this.transferCount = 0;
             this.setDonatingDepotCard();
         }
     }
 }
Пример #24
0
        private void PayBtn_Click(object sender, EventArgs e)
        {
            if (this.PO.delivered)
            {
                FormPagar formPagar = new FormPagar(this.PO.total - this.PO.pay, true);
                DarkForm  darkForm  = new DarkForm();
                darkForm.Show();
                if (formPagar.ShowDialog() == DialogResult.OK)
                {
                    this.PO.MakePayment(Convert.ToDouble(formPagar.Pay), this.CurrentEmployeeID);
                    this.updateValues();

                    if (m_Drawer != null)
                    {
                        try
                        {
                            //Open the device
                            //Use a Logical Device Name which has been set on the SetupPOS.
                            m_Drawer.Open();

                            //Get the exclusive control right for the opened device.
                            //Then the device is disable from other application.
                            m_Drawer.Claim(1000);

                            //Enable the device.
                            m_Drawer.DeviceEnabled = true;

                            //Open the drawer by using the "OpenDrawer" method.
                            m_Drawer.OpenDrawer();


                            m_Drawer.DeviceEnabled = false;
                            m_Drawer.Release();

                            m_Drawer.Close();
                        }
                        catch (PosControlException)
                        { useNativePrinter(); }
                    }
                    else
                    {
                        useNativePrinter();
                    }


                    //<<<step1>>>--End
                    MessageBox.Show("Se realizó abono con exito");
                    if (this.PO.paid)
                    {
                        if (inASearch)
                        {
                            searchPO();
                        }
                        else
                        {
                            this.loadPurchases();
                        }
                    }
                }
                darkForm.Close();
            }
            else
            {
                MessageBox.Show("Primero debe confirmar el pedido para realizar un abono", "No se puede realizar un abono", MessageBoxButtons.OK);
            }
        }