protected void btnGuardar_Click(object sender, EventArgs e) { string cMensaje = ""; try { if (ValidarDatos("OPE", ref cMensaje)) { txtFleteTra.Text = Math.Round(GetNumero(txtSubTotal.Text) / 100, 2).ToString(); txtFlete.Text = SetFormatNum(Math.Round(GetNumero(txtSubTotal.Text) / 100, 2)); if (lblProceso.Value == "NEW") { clsOperaciones lstOperaciones = new clsOperaciones(); long nOpeCod = lstOperaciones.MaxOpeCod() + 1; lblNroPedido.Text = nOpeCod.ToString().PadLeft(10, '0'); if (ddlTransportistas.Items.Count == 2) { ddlTransportistas.SelectedIndex = 1; ddlTransportistas_SelectedIndexChanged(sender, e); } txtDesEspec.Text = "0.0"; ddlVendedores.SelectedValue = ddlListaVendedores.SelectedValue; ddlVendedores.Enabled = false; ModalPopupGirarCompra.Show(); } else if (lblProceso.Value == "EDIT") { btnGuardarDocu_Click(sender, e); } } else { MessageBox(cMensaje); } } catch (Exception ex) { MessageBox("Error Interno: " + ex.Message); } }
protected void btnProcesar_Click(object sender, EventArgs e) { string cMensaje = ""; clsOperaciones lstOperaciones = new clsOperaciones(); long ndopCod = 0; int ntcmCod = 0; try { if (ValidarDatos("OPE", ref cMensaje)) { if (lblProceso.Value == "NEW") { txtFleteTra.Text = Math.Round(GetNumero(txtSubTotal.Text) / 100, 2).ToString(); txtFlete.Text = SetFormatNum(Math.Round(GetNumero(txtSubTotal.Text) / 100, 2)); long nOpeCod = lstOperaciones.MaxOpeCod() + 1; lblNroPedido.Text = nOpeCod.ToString().PadLeft(10, '0'); txtDesEspec.Text = "0.0"; } lstOperaciones.Procesar(this, gcOpeTipo, ref ndopCod, ref ntcmCod); lbldopCod.Value = ndopCod.ToString(); lbltcmCod.Value = ntcmCod.ToString(); lblOpeEstado.Value = "P"; GuardarDtCabeceraDocumento(); MessageBox("La Operacion fue Procesada con Exito, Ahora puede imprimir."); lblProceso.Value = "EDIT"; SetBotones(lblProceso.Value); } else { MessageBox(cMensaje); } } catch (Exception ex) { MessageBox("Error Interno: " + ex.Message); } }
protected void btnProcesar_Click(object sender, EventArgs e) { string cMensaje = ""; clsOperaciones lstOperaciones = new clsOperaciones(); long ndopCod = 0; int ntcmCod = 0; try { if (ValidarDatos("OPE", ref cMensaje,"PROC")) { if (lblProceso.Value == "NEW") { txtFleteTra.Text = Math.Round(GetNumero(txtSubTotal.Text) / 100, 2).ToString(); txtFlete.Text = SetFormatNum(Math.Round(GetNumero(txtSubTotal.Text) / 100, 2)); long nOpeCod = lstOperaciones.MaxOpeCod() + 1; lblNroPedido.Text = nOpeCod.ToString().PadLeft(10, '0'); txtDesEspec.Text = "0.0"; } lstOperaciones.Procesar(this, gcOpeTipo, ref ndopCod, ref ntcmCod); lbldopCod.Value = ndopCod.ToString(); lbltcmCod.Value = ntcmCod.ToString(); lblOpeEstado.Value = "P"; bDetallesChanged = 0; GuardarDtCabeceraDocumento(); MessageBox("La Operacion fue Procesada con Exito, Ahora puede imprimir."); //NUEVO: asigna funcion a botón IMPRIMIR AsignarFuncionBotonImprimir(); lblProceso.Value = "EDIT"; SetBotones(lblProceso.Value); ConfigurarDocumento(); /*generacion automatica de la letra*/ string valor = lblTipoDoc.Value; if (valor == "3" && ddlTipCiclo.SelectedValue == "D" && chkletra.Checked == true) { int cuotas = 1; int icodigo, idetcodigo; Double monto_total = Double.Parse(txtTotal.Text.ToString().Substring(3)); Double monto_nota = 0.00; String moneda; try { clsLetra _Letra = new clsLetra(); letra obj = new letra(); icodigo = Convert.ToInt32(_Letra.MaxOpeCod() + 1); obj.icodigo = icodigo; moneda = ddlMoneda.SelectedValue; obj.icodigo = icodigo; obj.itotcuota = cuotas; obj.nmontocuota = Convert.ToDecimal(monto_total); obj.cmoneda = moneda; obj.nintpag = Convert.ToDecimal(0.00); obj.iestado = "1"; obj.dfeccreacion = DateTime.Today; obj.dfecmod = DateTime.Today; obj.ctippago = "D"; obj.nmntnota = Convert.ToDecimal(monto_nota); _Letra.fnletraInsertar(obj); clsdetletra _detletra = new clsdetletra(); det_letra _detobj = new det_letra(); _detobj.icodletra = icodigo; _detobj.inumletra = 1; _detobj.cnumletra = "-"; _detobj.ccodletra = "-"; _detobj.nmonto = Convert.ToDecimal(monto_total); _detobj.cestado = "1"; _detobj.ninteres = Convert.ToDecimal(0.00); _detobj.dfecvenc = Convert.ToDateTime(txtFecha.Text).AddDays(Convert.ToInt16(this.txtCiclo.Text)); _detobj.dfecmod = DateTime.Today; idetcodigo = Convert.ToInt32(_detletra.Maxdetletra_cod()) + 1; _detobj.idetletra = idetcodigo; _detletra.fndet_letraInsertar(_detobj); clsDocumenOperacion _docobj = new clsDocumenOperacion(); DocumenOperacion _docope = new DocumenOperacion(); _docope = _docobj.GetDocumenOperaciona(dopcod_letra); _docope.icodletra = icodigo; _docobj.fnDocOpeUpdate(_docope); } catch (Exception ex) { MessageBox("Error Interno: " + ex.Message); } } } else { MessageBox(cMensaje); } } catch (Exception ex) { MessageBox("Error Interno: " + ex.Message + ex.InnerException.Message); } }