private void comboBox_Mesero_SelectedValueChanged(object sender, EventArgs e) { if (!siLoadComplete) { return; } try { DataRow[] RowVal; if (Classes.Class_Session.dtParamConf != null) { RowVal = Classes.Class_Session.dtParamConf.Select("vchtipo = 'Propina'"); if (RowVal.Count() > 0) { if (RowVal[0]["vchTipo"].ToString().Trim() != "") { Porcentaj_PropinaObjetivo = Convert.ToDouble(RowVal[0]["vchConfiguracion"].ToString()); } } } } catch { } CargaInfoCorte(); }
private void button_Terminar_Click(object sender, EventArgs e) { double fPropina = 0; if (textBox_Propina.Text.Trim() != "") { try { fPropina = Convert.ToDouble(textBox_Propina.Text.Trim()); } catch { MessageBox.Show("El monto ingresado como propina es incorrecto"); return; } } DialogResult Resp = MessageBox.Show(@"Esta usted seguro de cerrar la venta?", "Confirmar", MessageBoxButtons.YesNo); if (Resp == DialogResult.Yes) { if (FPAGADO >= FTOTAL) { if (Math.Abs(FTOTAL - FPAGADO) > Efectivo) { MessageBox.Show("El monto para dar cambio es mayor al que se tiene como efectivo"); button_Terminar.Enabled = false; return; } } double CambioReal = Math.Abs(FTOTAL - FPAGADO); double EfectivoReal = Efectivo - CambioReal; if (EfectivoReal > 0) { ClsPagoPedido.InsertaInformacionbyValor(IdPedido, "1", EfectivoReal);//1 1 01 Efectivo } if (Credito > 0) { ClsPagoPedido.InsertaInformacionbyValor(IdPedido, "4", Credito);//4 1 04 Tarjeta de crédito } if (Debito > 0) { ClsPagoPedido.InsertaInformacionbyValor(IdPedido, "18", Debito);//18 1 28 Tarjeta de débito } if (Vales > 0) { ClsPagoPedido.InsertaInformacionbyValor(IdPedido, "7", Vales);//7 1 08 Vales de despensa } if (Cheque > 0) { ClsPagoPedido.InsertaInformacionbyValor(IdPedido, "2", Cheque);//2 1 02 Cheque nominativo } if (Otro > 0) { ClsPagoPedido.InsertaInformacionbyValor(IdPedido, "20", Otro);//20 1 99 Pordefinir } ///Obtenemos la Ganancia object oGanancia = null; DataTable dtDetalle = ClsDetallePedidos.getDetallePedido(IdPedido); if (dtDetalle.Rows.Count > 0) { oGanancia = dtDetalle.Compute("Sum(fGanancia)", string.Empty); } double fGanancia = 0; try { if (oGanancia != null) { fGanancia = Convert.ToDouble(oGanancia); } } catch { } ///Cerramos y if (!ClsPedidos.CierraVenta(IdPedido, FTOTAL.ToString(), CambioReal.ToString(), fPropina, fGanancia)) { MessageBox.Show("Problema al Cerrar la venta, contacte al administrador"); return; } /// Imprimimos. DialogResult RespPrin = MessageBox.Show(@"Desea Imprimir el ticket?", "Confirmar", MessageBoxButtons.YesNo); if (RespPrin == DialogResult.Yes) { Classes.Print.Class_Pedido ClsPrint = new Classes.Print.Class_Pedido(IdPedido); ClsPrint.Imprimir(); } ///Restamos Existencia ClsProcesoRestar.RestaExisteciaVenta(IdPedido); /////////Enviar ticket a la Nuve DataRow[] RowVal; if (Classes.Class_Session.dtParamConf != null) { RowVal = Classes.Class_Session.dtParamConf.Select("vchtipo = 'Utilizar Auto-Factura? (SI/NO)'"); if (RowVal.Count() > 0) { if (RowVal[0]["vchConfiguracion"].ToString().Trim() == "SI") { try { DataTable dtPedido = ClsPedidos.getLista(" AND iidPedido = " + IdPedido); if (dtPedido.Rows.Count > 0) { DataTable pedido = new DataTable("pedido"); pedido.Columns.Add("KEY", typeof(string)); pedido.Columns.Add("Id", typeof(string)); pedido.Columns.Add("SubTotal", typeof(float)); pedido.Columns.Add("Descuento", typeof(float)); pedido.Columns.Add("IVA", typeof(float)); pedido.Columns.Add("Total", typeof(float)); pedido.Columns.Add("ID_EMPRESA", typeof(string)); pedido.Columns.Add("fechaTicket", typeof(string)); DataRow ROW = pedido.NewRow(); ROW["KEY"] = dtPedido.Rows[0]["vchkey"].ToString(); ROW["Id"] = IdPedido; ROW["SubTotal"] = dtPedido.Rows[0]["fSubtotal"].ToString(); ROW["Descuento"] = dtPedido.Rows[0]["fDescuento"].ToString(); ROW["IVA"] = dtPedido.Rows[0]["IVA"].ToString(); ROW["Total"] = dtPedido.Rows[0]["fTotal"].ToString(); ROW["ID_EMPRESA"] = dtPedido.Rows[0]["ID_EMPRESA"].ToString(); ROW["fechaTicket"] = dtPedido.Rows[0]["dfechaIn126"].ToString(); pedido.Rows.Add(ROW); wschefControl.Service1 WebSer = new wschefControl.Service1(); try { WebSer.Upticket(pedido); //se sube la factura } catch (System.Exception) { MessageBox.Show("Error al enviar información de autofactura."); } } } catch { } } } } /////////////// this.Close(); try { lista_pedidos(); } catch { } } }
public Class_Corte(string idCorte) { ImageLogo = null;///iNCLUIR iMAGEN if (SiLogoTick) { try { //obtiene la imagen almacenada en la clase logo Class_logo Cls_logo = new Class_logo(); ImageLogo = Image.FromHbitmap(Cls_logo.getLogo().GetHbitmap()); } catch (Exception) { ImageLogo = null; } } if (ImageLogo != null) { if (ImageLogo.Width > MaxWithlogo) { int NewHeight = (ImageLogo.Height * MaxWithlogo) / ImageLogo.Width; int NewWidth = MaxWithlogo; System.Drawing.Image NewImage = ImageLogo.GetThumbnailImage(NewWidth, NewHeight, null, IntPtr.Zero); ImageLogo.Dispose(); ImageLogo = NewImage; } } sb = new StringBuilder(); DataTable dtCorte = ClsCorte.getListaWhere(" WHERE iidCorte = " + idCorte); if (dtCorte.Rows.Count == 0) { return; } string MensajeTop = ""; string MensajePie = ""; string ShowTelefono = ""; DataRow[] RowVal; if (Classes.Class_Session.dtParamConf != null) { RowVal = Classes.Class_Session.dtParamConf.Select("vchtipo = 'Dirección local'"); if (RowVal.Count() > 0) { if (RowVal[0]["vchTipo"].ToString().Trim() != "") { MensajeTop = RowVal[0]["vchConfiguracion"].ToString(); } } RowVal = Classes.Class_Session.dtParamConf.Select("vchtipo = 'Telefono'"); if (RowVal.Count() > 0) { if (RowVal[0]["vchTipo"].ToString().Trim() != "") { ShowTelefono = RowVal[0]["vchConfiguracion"].ToString(); } } ///Caracteres por linea try { RowVal = Classes.Class_Session.dtParamConf.Select("vchtipo = 'Caracteres x Linea'"); if (RowVal.Count() > 0) { if (RowVal[0]["vchTipo"].ToString().Trim() != "") { charMaximoXLinea = Convert.ToInt32(RowVal[0]["vchConfiguracion"].ToString()); } } } catch { } try { RowVal = Classes.Class_Session.dtParamConf.Select("vchtipo = 'Tamaño Fuente'"); if (RowVal.Count() > 0) { if (RowVal[0]["vchTipo"].ToString().Trim() != "") { fontSize = Convert.ToInt32(RowVal[0]["vchConfiguracion"].ToString()); } } } catch { } } DatosJustificado(" "); DatosJustificado(" "); DatosJustificado("Av. Vallarta 5145. Local L15, Iconia, Camino Real, 45040 Zapopan, Jal."); if (MensajeTop.Trim() != "") { DatosJustificado(""); } if (ShowTelefono.Trim() != "") { DatosJustificado(" TELEFONO: " + ShowTelefono.Trim()); } DatosJustificado(" "); DatosJustificado(" "); DatosJustificado("No Corte: " + Convert.ToInt32(idCorte).ToString("000000")); TextosExtremos(dtCorte.Rows[0]["dfechaIn103"].ToString(), dtCorte.Rows[0]["dfechaIn108"].ToString()); DatosJustificado(" "); TextoCentro(" V E N T A T O T A L "); TextoCentro(string.Format("{0:c}", Convert.ToDouble(dtCorte.Rows[0]["fVentaTotal"].ToString()))); DatosJustificado(" "); DatosJustificado(" "); Totales("Venta", Convert.ToDouble(dtCorte.Rows[0]["fVentaTotal"].ToString())); Totales("Salidas", Convert.ToDouble(dtCorte.Rows[0]["fMontoSalidaDinero"].ToString())); Totales("Entrada", Convert.ToDouble(dtCorte.Rows[0]["fMontoEntradaDinero"].ToString())); Totales("Inicial", Convert.ToDouble(dtCorte.Rows[0]["fMontoInicial"].ToString())); LineasGuiones("-"); double fTotalFinal = Convert.ToDouble(dtCorte.Rows[0]["fTotalFinal"].ToString()) + Convert.ToDouble(dtCorte.Rows[0]["fMontoInicial"].ToString()); Totales("Total Final", fTotalFinal); Totales("Entregado", Convert.ToDouble(dtCorte.Rows[0]["fTotalEntregado"].ToString())); if (fTotalFinal > Convert.ToDouble(dtCorte.Rows[0]["fTotalEntregado"].ToString())) { double Faltante = fTotalFinal - Convert.ToDouble(dtCorte.Rows[0]["fTotalEntregado"].ToString()); Totales("Faltante", Faltante); } else { if (Convert.ToDouble(dtCorte.Rows[0]["fTotalEntregado"].ToString()) > fTotalFinal) { double Sobrante = Convert.ToDouble(dtCorte.Rows[0]["fTotalEntregado"].ToString()) - fTotalFinal; Totales("Sobrante", Sobrante); } } DatosJustificado(" "); DatosJustificado(" "); TextoCentro("ENTREGAS"); DatosJustificado(" "); Totales("Efectivo", Convert.ToDouble(dtCorte.Rows[0]["fEntregaEfectivo"].ToString())); Totales("Credito", Convert.ToDouble(dtCorte.Rows[0]["fEntregaCreditoTC"].ToString())); Totales("Debito", Convert.ToDouble(dtCorte.Rows[0]["fEntregaDebito"].ToString())); Totales("Vales", Convert.ToDouble(dtCorte.Rows[0]["fEntregaVales"].ToString())); Totales("Cheque", Convert.ToDouble(dtCorte.Rows[0]["fEntregaCheque"].ToString())); Totales("Otro", Convert.ToDouble(dtCorte.Rows[0]["fEntregaOtro"].ToString())); DatosJustificado(" "); DatosJustificado(" "); TextoCentro("VENTAS X FORMA DE PAGO"); DatosJustificado(" "); Totales("Efectivo", Convert.ToDouble(dtCorte.Rows[0]["fVentaEfectivo"].ToString())); Totales("Credito", Convert.ToDouble(dtCorte.Rows[0]["fVentaCreditoTC"].ToString())); Totales("Debito", Convert.ToDouble(dtCorte.Rows[0]["fVentaDebito"].ToString())); Totales("Vales", Convert.ToDouble(dtCorte.Rows[0]["fVentaVales"].ToString())); Totales("Cheque", Convert.ToDouble(dtCorte.Rows[0]["fVentaCheque"].ToString())); Totales("Otro", Convert.ToDouble(dtCorte.Rows[0]["fVentaOtro"].ToString())); DatosJustificado(" "); DatosJustificado(" "); DatosJustificado(" "); DatosJustificado(" "); cortarTicket(); }
private void toolStripButton_EnviarMail_Click(object sender, EventArgs e) { int contador = 0; string IdCortes = "0"; dataGridView1.EndEdit(); foreach (DataGridViewRow registro in dataGridView1.Rows) { try { if ((Boolean)registro.Cells["Seleccionar"].Value == true) { IdCortes += "," + registro.Cells["Folio"].Value.ToString(); contador++; } } catch { } } if (contador == 0) { MessageBox.Show("Debe seleccionar al menos un registro."); return; } DialogResult res = MessageBox.Show(@"Esta usted seguro de cancelar las ventas seleccionadas?", "Confirmar", MessageBoxButtons.YesNo); if (res == DialogResult.Yes) { ///correo notificacion string CorreoEnvio = ""; DataRow[] RowVal; if (Classes.Class_Session.dtParamConf != null) { RowVal = Classes.Class_Session.dtParamConf.Select("vchtipo = 'Notificación Corte'"); if (RowVal.Count() > 0) { if (RowVal[0]["vchTipo"].ToString().Trim() != "") { CorreoEnvio = RowVal[0]["vchConfiguracion"].ToString(); } } } if (CorreoEnvio == "") { MessageBox.Show("No existe Correo Configurado para el envio del corte"); return; } //// string[] valores = IdCortes.Split(','); for (int i = 0; i < valores.Length; i++) { if (valores[i] != "0") { string IdCorte = valores[i]; //Enviamos Classes.Correo.Class_EnviaCorte ClsSendCorte = new Classes.Correo.Class_EnviaCorte(); if (ClsSendCorte.EnviaCorreo(IdCorte, CorreoEnvio)) { MessageBox.Show("Correo enviado con exito"); return; } else { MessageBox.Show("Problema al enviar, intente mas tarde"); return; } } } } }
public Class_Pedido(string idPedido) { ImageLogo = null;///iNCLUIR iMAGEN if (SiLogoTick) { try { //obtiene la imagen almacenada en la clase logo Class_logo Cls_logo = new Class_logo(); ImageLogo = Image.FromHbitmap(Cls_logo.getLogo().GetHbitmap()); } catch (Exception) { ImageLogo = null; } } if (ImageLogo != null) { if (ImageLogo.Width > MaxWithlogo) { int NewHeight = (ImageLogo.Height * MaxWithlogo) / ImageLogo.Width; int NewWidth = MaxWithlogo; System.Drawing.Image NewImage = ImageLogo.GetThumbnailImage(NewWidth, NewHeight, null, IntPtr.Zero); ImageLogo.Dispose(); ImageLogo = NewImage; } } sb = new StringBuilder(); DataTable dtPedido = ClsPedido.getLista(" AND P.iidPedido = " + idPedido); if (dtPedido.Rows.Count == 0) { return; } DataRow RowPedido = dtPedido.Rows[0]; DataTable dtDetalle = ClsDetallePedido.getDetallePedido(idPedido); string MensajeTop = ""; string MensajePie = ""; string ShowTelefono = ""; string SubMesa = ClsPedido.getSubMesaId(RowPedido["iidMesa"].ToString(), RowPedido["iidPedido"].ToString()); DataRow[] RowVal; if (Classes.Class_Session.dtParamConf != null) { RowVal = Classes.Class_Session.dtParamConf.Select("vchtipo = 'Dirección local'"); if (RowVal.Count() > 0) { if (RowVal[0]["vchTipo"].ToString().Trim() != "") { MensajeTop = RowVal[0]["vchConfiguracion"].ToString(); } } RowVal = Classes.Class_Session.dtParamConf.Select("vchtipo = 'Telefono'"); if (RowVal.Count() > 0) { if (RowVal[0]["vchTipo"].ToString().Trim() != "") { ShowTelefono = RowVal[0]["vchConfiguracion"].ToString(); } } ///Caracteres por linea try { RowVal = Classes.Class_Session.dtParamConf.Select("vchtipo = 'Caracteres x Linea'"); if (RowVal.Count() > 0) { if (RowVal[0]["vchTipo"].ToString().Trim() != "") { charMaximoXLinea = Convert.ToInt32(RowVal[0]["vchConfiguracion"].ToString()); } } } catch { } try { RowVal = Classes.Class_Session.dtParamConf.Select("vchtipo = 'Tamaño Fuente'"); if (RowVal.Count() > 0) { if (RowVal[0]["vchTipo"].ToString().Trim() != "") { fontSize = Convert.ToInt32(RowVal[0]["vchConfiguracion"].ToString()); } } } catch { } } DatosJustificado(" "); DatosJustificado(" "); DatosJustificado("Av. Vallarta 5145. Local L15, Iconia, Camino Real, 45040 Zapopan, Jal."); if (MensajeTop.Trim() != "") { DatosJustificado(" "); } if (ShowTelefono.Trim() != "") { DatosJustificado(" TELEFONO: " + ShowTelefono.Trim()); } DatosJustificado(" "); DatosJustificado(" "); DatosJustificado("Numero de Pedido: " + Convert.ToInt32(RowPedido["iidPedido"].ToString()).ToString("000000")); DatosJustificado(""); DatosJustificado("DOCUMENTO: Nota de Venta"); LineasGuiones("-"); TextosExtremos(RowPedido["dfechaIn103"].ToString(), RowPedido["dfechaIn108"].ToString()); DatosJustificado("Le atendio: " + RowPedido["Mesero"].ToString()); LineasGuiones("-"); TextoCentro("DETALLE COMPRA"); LineasGuiones("-"); DatosJustificado(" CANTIDAD / PRODUCTO / PRECIO "); LineasGuiones("-"); foreach (DataRow Row in dtDetalle.Rows) { try { AgregarProductos(Convert.ToDouble(Row["fCantidad"].ToString()), Row["vchDescripcion"].ToString(), Convert.ToDouble(Row["fPrecio"].ToString()), Convert.ToDouble(Row["fImporte"].ToString())); }catch {} } double fSubtotal = 0; double fDescuento = 0; double fTotal = 0; double fPropina = 0; double totalComida = 0; double totalBebida = 0; try { fSubtotal = Convert.ToDouble(RowPedido["fSubtotal"].ToString()); fDescuento = Convert.ToDouble(RowPedido["fDescuento"].ToString()); fTotal = Convert.ToDouble(RowPedido["fTotal"].ToString()); fPropina = Convert.ToDouble(RowPedido["fPropina"].ToString()); } catch { } LineasGuiones("-"); TextosExtremos("Subtotal", string.Format("{0:c}", fSubtotal)); if (fDescuento > 0) { TextosExtremos("Descuento", string.Format("{0:c}", fDescuento)); } TextosExtremos("Total", string.Format("{0:c}", fTotal)); /*if (fPropina > 0) * { * DatosJustificado(" "); * DatosJustificado(" "); * TextosExtremos("Propina sugerida", string.Format("{0:c}", fPropina)); * DatosJustificado(" "); * DatosJustificado(" "); * }*/ /* * LineasGuiones("-"); * LineasGuiones("-"); * TextoCentro("RESUMEN SECCIONADO:"); * * if (totalComida > 0) * TextosExtremos("En Comida", string.Format("{0:c}", fPropina)); * if (totalBebida > 0) * TextosExtremos(" En Bebida", string.Format("{0:c}", totalBebida));*/ LineasGuiones("-"); DatosJustificado(" "); DatosJustificado(" "); DatosJustificado(" "); DatosJustificado(" "); if (Classes.Class_Session.dtParamConf != null) { RowVal = Classes.Class_Session.dtParamConf.Select("vchtipo = 'Ticket Msg L1'"); if (RowVal.Count() > 0) { if (RowVal[0]["vchTipo"].ToString().Trim() != "") { TextoCentro(RowVal[0]["vchConfiguracion"].ToString()); } } RowVal = Classes.Class_Session.dtParamConf.Select("vchtipo = 'Ticket Msg L2'"); if (RowVal.Count() > 0) { if (RowVal[0]["vchTipo"].ToString().Trim() != "") { TextoCentro(RowVal[0]["vchConfiguracion"].ToString()); } } RowVal = Classes.Class_Session.dtParamConf.Select("vchtipo = 'Ticket Msg L3'"); if (RowVal.Count() > 0) { if (RowVal[0]["vchTipo"].ToString().Trim() != "") { TextoCentro(RowVal[0]["vchConfiguracion"].ToString()); } } } DatosJustificado(" "); DatosJustificado(" "); DatosJustificado(" "); DatosJustificado(" "); cortarTicket(); }
public Class_CorteMesero(string idCorte) { ImageLogo = null;///iNCLUIR iMAGEN if (SiLogoTick) { try { //obtiene la imagen almacenada en la clase logo Class_logo Cls_logo = new Class_logo(); ImageLogo = Image.FromHbitmap(Cls_logo.getLogo().GetHbitmap()); } catch (Exception) { ImageLogo = null; } } if (ImageLogo != null) { if (ImageLogo.Width > MaxWithlogo) { int NewHeight = (ImageLogo.Height * MaxWithlogo) / ImageLogo.Width; int NewWidth = MaxWithlogo; System.Drawing.Image NewImage = ImageLogo.GetThumbnailImage(NewWidth, NewHeight, null, IntPtr.Zero); ImageLogo.Dispose(); ImageLogo = NewImage; } } sb = new StringBuilder(); DataTable dtCorte = ClsCorteMesero.getListaWhere(" WHERE iidCorteMesero = " + idCorte); if (dtCorte.Rows.Count == 0) { return; } DataRow[] RowVal; if (Classes.Class_Session.dtParamConf != null) { ///Caracteres por linea try { RowVal = Classes.Class_Session.dtParamConf.Select("vchtipo = 'Caracteres x Linea'"); if (RowVal.Count() > 0) { if (RowVal[0]["vchTipo"].ToString().Trim() != "") { charMaximoXLinea = Convert.ToInt32(RowVal[0]["vchConfiguracion"].ToString()); } } } catch { } try { RowVal = Classes.Class_Session.dtParamConf.Select("vchtipo = 'Tamaño Fuente'"); if (RowVal.Count() > 0) { if (RowVal[0]["vchTipo"].ToString().Trim() != "") { fontSize = Convert.ToInt32(RowVal[0]["vchConfiguracion"].ToString()); } } } catch { } } DatosJustificado(" "); DatosJustificado(" "); DatosJustificado(" "); DatosJustificado(" "); DatosJustificado("No Corte: " + Convert.ToInt32(idCorte).ToString("000000")); TextosExtremos(dtCorte.Rows[0]["dfechaIn103"].ToString(), dtCorte.Rows[0]["dfechaIn108"].ToString()); DatosJustificado(" No Pedidos: " + dtCorte.Rows[0]["iNumPedidos"].ToString()); DatosJustificado(" Personas Promedio por Mesa: " + dtCorte.Rows[0]["iNumPedidos"].ToString()); DatosJustificado(" "); TextoCentro(" V E N T A T O T A L "); DatosJustificado(" "); TextoCentro(string.Format("{0:c}", Convert.ToDouble(dtCorte.Rows[0]["fVentaTotal"].ToString()))); DatosJustificado(" "); TextoCentro("P R O P I N A O B J E T I V O"); DatosJustificado(" "); TextoCentro(string.Format("{0:c}", Convert.ToDouble(dtCorte.Rows[0]["fPropinaObjetivo"].ToString()))); DatosJustificado(" "); TextoCentro("P R O P I N A O P T E N I D A"); DatosJustificado(" "); TextoCentro(string.Format("{0:c}", Convert.ToDouble(dtCorte.Rows[0]["fPropinaReal"].ToString()))); LineasGuiones("-"); LineasGuiones("-"); DataTable dtDet = ClsDetCorteMesero.getLista(" AND D.iidCorteMesero = " + idCorte); if (dtDet.Rows.Count > 0) { foreach (DataRow RowDet in dtDet.Rows) { Totales(RowDet["vchNombre"].ToString(), Convert.ToDouble(RowDet["fPropinaObtenida"].ToString())); } } DatosJustificado(" "); DatosJustificado(" "); DatosJustificado("."); cortarTicket(); }