private void CargarCamposDocumento(int _dopCod, string cDopDescri) { clsDocumenOperacion lstDocumenOpe = new clsDocumenOperacion(); DocumenOperacion DocumenOpe = new DocumenOperacion(); try { DocumenOpe = lstDocumenOpe.GetDocumenOperacion(_dopCod); lblTipoDoc.Value = ddlTipoDocu.SelectedValue; lblDescriDocumento.Text = cDopDescri; lblTipoDoc.Value = DocumenOpe.tdoCod.ToString(); lbldopCod.Value = DocumenOpe.dopCod.ToString(); lblNroDocumento.Text = DocumenOpe.dopNroSerie.ToString() + " - " + DocumenOpe.dopNumero.ToString(); txtFecha.Text = ((DateTime)DocumenOpe.dopFecEmision).ToString("yyyy-MM-dd"); switch (lblTipoDoc.Value) { case "2": btnImprimir.OnClientClick = "AbrirVentanaGuia()"; break; case "4": btnImprimir.OnClientClick = "AbrirVentanaNota()"; break; case "5": btnImprimir.OnClientClick = "AbrirVentanaBoleta()"; break; default: btnImprimir.OnClientClick = "AbrirVentanaFactura()"; break; } } catch (Exception ex) { MessageBox("Error Interno: " + ex.Message); } }
private void CargarCamposDocumento(int _dopCod, string cDopDescri) { clsDocumenOperacion lstDocumenOpe = new clsDocumenOperacion(); DocumenOperacion DocumenOpe = new DocumenOperacion(); try { DocumenOpe = lstDocumenOpe.GetDocumenOperacion(_dopCod); lblTipoDoc.Value = ddlTipoDocu.SelectedValue; lblDescriDocumento.Text = cDopDescri; lblTipoDoc.Value = DocumenOpe.tdoCod.ToString(); lbldopCod.Value = DocumenOpe.dopCod.ToString(); lblNroDocumento.Text = DocumenOpe.dopNroSerie.ToString() + " - " + DocumenOpe.dopNumero.ToString(); txtFecha.Text = ((DateTime)DocumenOpe.dopFecEmision).ToString("yyyy-MM-dd"); if (DocumenOpe.dopFecTraslado != null) txtFecTraslado.Text = ((DateTime)DocumenOpe.dopFecTraslado).ToString("yyyy-MM-dd"); else txtFecTraslado.Text = ((DateTime)DocumenOpe.dopFecEmision).ToString("yyyy-MM-dd"); if (DocumenOpe.dopPunPartida != null) txtPuntoPartida.Text = DocumenOpe.dopPunPartida; else txtPuntoPartida.Text = ""; ConfigurarDocumento(); GuardarDtCabeceraDocumento(); } catch (Exception ex) { MessageBox("Error Interno: " + ex.Message); } }
protected void GuardarDtCabeceraDocumento() { DocumenOperacion DocumenOpe = new DocumenOperacion(); clsDocumenOperacion lstDocumenOpe = new clsDocumenOperacion(); DataTable dtCabeceraOperacion = CreatDTCabeceraVenta(); int OpeCod = int.Parse(lblNroPedido.Text); string NroGuia = ""; string NroPedido = ""; DocumenOpe = lstDocumenOpe.GetDocumenOperacion(OpeCod, 2); if (DocumenOpe != null) { NroGuia = DocumenOpe.dopNroSerie.ToString() + " - " + DocumenOpe.dopNumero.ToString(); } DocumenOpe = lstDocumenOpe.GetDocumenOperacion(OpeCod, 4); if (DocumenOpe != null) { NroPedido = DocumenOpe.dopNroSerie.ToString() + " - " + DocumenOpe.dopNumero.ToString(); } DataRow newRow = dtCabeceraOperacion.NewRow(); newRow["cRazonSocial"] = ddlClientes.SelectedItem.Text; newRow["cDireccion"] = txtDireccion.Text; newRow["cTelefono"] = txtTelefono.Text; newRow["cNroGuia"] = NroGuia; newRow["cNroPedido"] = NroPedido; newRow["cRuc"] = txtDocCli.Text; newRow["cFormaPago"] = ddlTipoVenta.SelectedItem.Text; newRow["cAnio"] = DateTime.Parse(txtFecha.Text).Year.ToString(); newRow["cMes"] = DateTime.Parse(txtFecha.Text).Month.ToString(); newRow["cDia"] = DateTime.Parse(txtFecha.Text).Day.ToString(); newRow["cValorVenta"] = SetFormatNum(GetNumero(txtValorVenta.Text) -GetNumero(txtDescuento.Text)); newRow["cFlete"] = txtFlete.Text; newRow["cIGV"] = txtIgv.Text; newRow["cTotal"] = txtTotal.Text; newRow["cTotalSinFlete"] = SetFormatNum(GetNumero(newRow["cValorVenta"].ToString()) * (nTasIGV+1)); newRow["cTotalLetras"] = ConvertiraLetras(decimal.Parse((txtTotal.Text.Replace("S/.", "").Trim()).Replace("$", "").Trim())); newRow["Destinatario"] = ""; newRow["PLlegada"] = ""; newRow["NroFactura"] = ""; newRow["Unidad"] = ""; dtCabeceraOperacion.Rows.Add(newRow); AgregarVariableSession("dtCabeceraOperacion", dtCabeceraOperacion); }
protected void GuardarDtCabeceraDocumento() { DocumenOperacion DocumenOpe = new DocumenOperacion(); clsDocumenOperacion lstDocumenOpe = new clsDocumenOperacion(); DataTable dtCabeceraOperacion = CreatDTCabeceraVenta(); int OpeCod = int.Parse(lblNroPedido.Text); string NroGuia = "", NroFactura = "", moneda = "", NroPedido = "", cPuntoPartida = "", cFecTraslado = "", cFormaPago = ""; DocumenOpe = lstDocumenOpe.GetDocumenOperacion(OpeCod, 3); if (DocumenOpe != null) { NroFactura = DocumenOpe.dopNroSerie.ToString() + " - " + DocumenOpe.dopNumero.ToString(); //////////////////////cmbios silvia/////////////////////////// dopcod_letra = Convert.ToInt32(DocumenOpe.dopCod); ///////////////////////////////////////////////////////////// } DocumenOpe = lstDocumenOpe.GetDocumenOperacion(OpeCod, 2); if (DocumenOpe != null) { NroGuia = DocumenOpe.dopNroSerie.ToString() + " - " + DocumenOpe.dopNumero.ToString(); if (DocumenOpe.dopPunPartida != null) cPuntoPartida = DocumenOpe.dopPunPartida; if (DocumenOpe.dopFecTraslado != null) cFecTraslado = ((DateTime)DocumenOpe.dopFecTraslado).ToString("yyyy-MM-dd"); else cFecTraslado = ((DateTime)DocumenOpe.dopFecEmision).ToString("yyyy-MM-dd"); } if (txtOpeOrdCompra.Text != "") NroPedido = txtOpeOrdCompra.Text; else { DocumenOpe = lstDocumenOpe.GetDocumenOperacion(OpeCod, 4); if (DocumenOpe != null) { NroPedido = DocumenOpe.dopNroSerie.ToString() + " - " + DocumenOpe.dopNumero.ToString(); } } if (ddlMoneda.SelectedValue == "PEN") moneda = " Nuevos Soles"; else moneda = " Dolares"; if (ddlTipoVenta.SelectedValue == "CR") cFormaPago = txtCiclo.Text + " " + ddlTipCiclo.SelectedItem.Text; else cFormaPago = ddlTipoVenta.SelectedItem.Text; DataRow newRow = dtCabeceraOperacion.NewRow(); newRow["cRazonSocial"] = ddlClientes.SelectedItem.Text; newRow["cDireccion"] = txtDireccion.Text; newRow["cTelefono"] = txtTelefono.Text; newRow["cNroGuia"] = NroGuia; newRow["cNroPedido"] = NroPedido; newRow["cRuc"] = txtDocCli.Text; newRow["cFormaPago"] = cFormaPago; newRow["cSimboloMon"] = ddlMoneda.SelectedValue == "PEN" ? "S/." : "$"; newRow["cAnio"] = DateTime.Parse(txtFecha.Text).Year.ToString(); newRow["cMes"] = DateTime.Parse(txtFecha.Text).Month.ToString(); newRow["cDia"] = DateTime.Parse(txtFecha.Text).Day.ToString(); newRow["cValorVenta"] = (GetNumero(txtValorVenta.Text, false) - GetNumero(txtDescuento.Text, false)).ToString("F2"); newRow["cFlete"] = GetNumero(txtFlete.Text, false).ToString("F2"); newRow["cIGV"] = GetNumero(txtIgv.Text, false).ToString("F2"); newRow["cTotal"] = GetNumero(txtTotal.Text, false).ToString("F2"); newRow["cTotalSinFlete"] = SetFormatNum(GetNumero(newRow["cValorVenta"].ToString()) * (nTasIGV + 1)); newRow["cTotalLetras"] = ConvertiraLetras(decimal.Parse((txtTotal.Text.Replace("S/.", "").Trim()).Replace("$", "").Trim())).ToUpper() + moneda.ToUpper(); newRow["Destinatario"] = ddlClientes.SelectedItem.Text; newRow["PLlegada"] = txtDireccion.Text; newRow["NroFactura"] = NroFactura; newRow["Unidad"] = ""; newRow["PPartida"] = cPuntoPartida; newRow["dFecTraslado"] = cFecTraslado; if (ddlTipoVenta.SelectedValue == "CR") { newRow["dOpeTipCiclo"] = ddlTipCiclo.SelectedItem.Text; newRow["dOpeCiclo"] = txtCiclo.Text; } else { newRow["dOpeTipCiclo"] = ""; newRow["dOpeCiclo"] = ""; } dtCabeceraOperacion.Rows.Add(newRow); AgregarVariableSession("dtCabeceraOperacion", dtCabeceraOperacion); }