Пример #1
0
        public Plantilla(eFact_I_Bj.RN.Plantilla.Modo Modo, eFact_I_Bj.Entidades.Plantilla plantillaParaExponer)
        {
            InitializeComponent();
            modo = Modo;
            this.Text = "Plantilla (" + modo.ToString() + ")";
            SeleccionarButton.Text = "Seleccionar";
            plantillaExpuesta = plantillaParaExponer;
            if (eFact_I_Bj.RN.Plantilla.Modo.Consulta == modo)
            {
                DescrPlantillaComboBox.Visible = true;
                EjecutarButton.Enabled = false;
                EjecutarButton.Visible = false;
                SeleccionarButton.Visible = true;
                SeleccionarButton.Enabled = true;
                LlenarCombo();
				DescrPlantillaTextBox.Text = "";
				Leyenda1TextBox.Text = "";
				Leyenda2TextBox.Text = "";
				Leyenda3TextBox.Text = "";
				Leyenda4TextBox.Text = "";
				Leyenda5TextBox.Text = "";
				LeyendaMonedaTextBox.Text = "";
				LeyendaBancoTextBox.Text = "";
            }
        }
Пример #2
0
 public void Lista(List<eFact_I_Bj.Entidades.Plantilla> Plantilla)
 {
     StringBuilder commandText = new StringBuilder();
     commandText.Append("Select * from Plantillas");
     DataTable dt = new DataTable();
     dt = (DataTable)Ejecutar(commandText.ToString(), TipoRetorno.TB, Transaccion.Acepta, sesion.CnnStr);
     if (dt.Rows.Count != 0)
     {
         for (int i = 0; i < dt.Rows.Count; i++)
         {
             eFact_I_Bj.Entidades.Plantilla p = new eFact_I_Bj.Entidades.Plantilla();
             Copiar(dt, i, p);
             Plantilla.Add(p);
         }
     }
 }
Пример #3
0
        private void EjecutarButton_Click(object sender, EventArgs e)
        {
            eFact_I_Bj.DB.Plantilla db = new eFact_I_Bj.DB.Plantilla(Aplicacion.Sesion);
            eFact_I_Bj.Entidades.Plantilla plantilla = new eFact_I_Bj.Entidades.Plantilla();
            plantilla.DescrPlantilla = DescrPlantillaTextBox.Text;
            plantilla.Leyenda1 = Leyenda1TextBox.Text;
            plantilla.Leyenda2 = Leyenda2TextBox.Text;
            plantilla.Leyenda3 = Leyenda3TextBox.Text;
            plantilla.Leyenda4 = Leyenda4TextBox.Text;
            plantilla.Leyenda5 = Leyenda5TextBox.Text;
            plantilla.LeyendaMoneda = LeyendaMonedaTextBox.Text;
            plantilla.LeyendaBanco = LeyendaBancoTextBox.Text;
            if (eFact_I_Bj.RN.Plantilla.Modo.Alta == modo)
            {
                db.Insertar(plantilla);
				MessageBox.Show("Alta efectuada", "Atención", MessageBoxButtons.OK);
            }
            else
            {
				plantilla.IdPlantilla = Convert.ToInt32(DescrPlantillaComboBox.SelectedValue.ToString());
				db.Modificar(plantilla);
				MessageBox.Show("Modificación efectuada", "Atención", MessageBoxButtons.OK);
            }
        }
Пример #4
0
 private void SeleccionarButton_Click(object sender, EventArgs e)
 {
     plantillaExpuesta = (eFact_I_Bj.Entidades.Plantilla) DescrPlantillaComboBox.SelectedItem;
     this.Close();
 }
Пример #5
0
 private void DescrPlantillaComboBox_SelectedValueChanged(object sender, EventArgs e)
 {
     eFact_I_Bj.DB.Plantilla db = new eFact_I_Bj.DB.Plantilla(Aplicacion.Sesion);
     eFact_I_Bj.Entidades.Plantilla plantilla = new eFact_I_Bj.Entidades.Plantilla();
     if (DescrPlantillaComboBox.SelectedValue != null)
     {
         plantilla.IdPlantilla = Convert.ToInt32(DescrPlantillaComboBox.SelectedValue.ToString());
         db.Leer(plantilla);
         if (plantilla.DescrPlantilla != "")
         {
             EjecutarButton.Enabled = true;
             DescrPlantillaTextBox.Text = plantilla.DescrPlantilla;
             Leyenda1TextBox.Text = plantilla.Leyenda1;
             Leyenda2TextBox.Text = plantilla.Leyenda2;
             Leyenda3TextBox.Text = plantilla.Leyenda3;
             Leyenda4TextBox.Text = plantilla.Leyenda4;
             Leyenda5TextBox.Text = plantilla.Leyenda5;
             LeyendaMonedaTextBox.Text = plantilla.LeyendaMoneda;
             LeyendaBancoTextBox.Text = plantilla.LeyendaBanco;
             EjecutarButton.Enabled = true;
         }
     }
 }
Пример #6
0
        private void GenerarArchivoButton_Click(object sender, EventArgs e)
        {
            try
            {
                if (ConsultaComprobantesDataGridView.SelectedRows.Count != 0)
                {
                    int renglon = ConsultaComprobantesDataGridView.SelectedRows[0].Index;
                    try
                    {
                        eFact_I_Bj.Entidades.Plantilla plantillaExpuesta = new eFact_I_Bj.Entidades.Plantilla();
                        Plantilla plantilla = new Plantilla(eFact_I_Bj.RN.Plantilla.Modo.Consulta, plantillaExpuesta);
                        plantilla.ShowDialog();
                        plantillaExpuesta = plantilla.plantillaExpuesta;
                        plantilla = null;
                        string observaciones = string.Empty;
                        if (plantillaExpuesta != null)
                        {
                            //foreach (eFact_I_Bj.Entidades.ComprobanteBj comprobante in Comprobantes)
                            //{
                                //if (Comprobantes[renglon].Leyendas[0].ToString() != string.Empty)
                                //{
                                //    string leyenda = Comprobantes[renglon].Leyendas[0].ToString();
                                //    observaciones = observaciones + plantillaExpuesta.Leyenda1 + " " + leyenda + " ";
                                //}
                                if (Comprobantes[renglon].Leyendas[1].ToString() != string.Empty)
                                {
                                    string leyenda = Comprobantes[renglon].Leyendas[1].ToString();
                                    observaciones = observaciones + plantillaExpuesta.Leyenda2 + " " + leyenda + " ";
                                }
                                if (Comprobantes[renglon].Leyendas[2].ToString() != string.Empty)
                                {
                                    string leyenda = Comprobantes[renglon].Leyendas[2].ToString();
                                    observaciones = observaciones + plantillaExpuesta.Leyenda3 + " " + leyenda + " ";
                                }
                                if (Comprobantes[renglon].Leyendas[3].ToString() != string.Empty)
                                {
                                    string leyenda = Comprobantes[renglon].Leyendas[3].ToString();
                                    observaciones = observaciones + plantillaExpuesta.Leyenda4 + " " + leyenda + " ";
                                }
                                if (Comprobantes[renglon].Leyendas[4].ToString() != string.Empty)
                                {
                                    string leyenda = Comprobantes[renglon].Leyendas[4].ToString();
                                    observaciones = observaciones + plantillaExpuesta.Leyenda5 + " " + leyenda + " ";
                                }
                                observaciones = observaciones + plantillaExpuesta.LeyendaMoneda + " " + " ";
                                Lc.comprobante[renglon].extensiones = new FeaEntidades.InterFacturas.extensiones();
                                Lc.comprobante[renglon].extensiones.extensiones_datos_comerciales = observaciones;
                                Lc.comprobante[renglon].extensionesSpecified = true;
                                Lc.comprobante[renglon].resumen.observaciones = plantillaExpuesta.LeyendaBanco;
                            //}
                        }
						if (FactServiciosCheckBox.Checked)
						{
							Lc.comprobante[renglon].cabecera.informacion_comprobante.fecha_serv_desde = FechaDsdServ.Value.ToString("yyyyMMdd");
							Lc.comprobante[renglon].cabecera.informacion_comprobante.fecha_serv_hasta = FechaHstServ.Value.ToString("yyyyMMdd");
							Lc.comprobante[renglon].cabecera.informacion_comprobante.codigo_conceptoSpecified = true;
							Lc.comprobante[renglon].cabecera.informacion_comprobante.codigo_concepto = 2;
						}
						if (FactDolarCheckBox.Checked)
						{
							string comentario = "Este documento se emite por el importe equivalente a USD "+ ImporteDolaresTextBox.Text +" al TC "+ TipoCambioTextBox.Text +" ARS/USD. De existir diferencia entre este tipo de cambio y el que corresponda al día anterior al pago efectivo, el pago se considerara hecho a cuenta y la diferencia generada deberá ser compensada mediante una ND/NC según corresponda a ser emitida por Gas Patagonia S.A.";
							Lc.comprobante[renglon].detalle.comentarios = comentario;
						}
                        
                        //Crear "lote_comprobantes"
                        string LoteXML;
                        //Metodo estático para el armado del Lote en formato XML, no necesita usar el constructor con la URL, proxy y certificados.
                        //Para Contingencias: El string LoteXML deberá guardarse en un archivo para se subido al Sitio Web de Interfacturas.
                        FeaEntidades.InterFacturas.lote_comprobantes lcComprobanteSelec = new FeaEntidades.InterFacturas.lote_comprobantes();
						lcComprobanteSelec.cabecera_lote = Lc.cabecera_lote;
						lcComprobanteSelec.cabecera_lote.cantidad_reg = 1;
                        lcComprobanteSelec.comprobante[0] = Lc.comprobante[renglon];
						if (plantillaExpuesta.DescrPlantilla.Equals("Diferencia de Cambio"))
						{
							for (int i = 1; i < lcComprobanteSelec.comprobante[0].detalle.linea.Length; i++)
							{
								if (lcComprobanteSelec.comprobante[0].detalle.linea[i] != null)
								{
									lcComprobanteSelec.comprobante[0].detalle.linea[i] = null;
								}
							}
							lcComprobanteSelec.comprobante[0].detalle.linea[0].cantidadSpecified = false;
							lcComprobanteSelec.comprobante[0].detalle.linea[0].precio_unitarioSpecified = false;
							lcComprobanteSelec.comprobante[0].detalle.linea[0].importe_ivaSpecified = false;
							lcComprobanteSelec.comprobante[0].detalle.linea[0].alicuota_ivaSpecified = false;
							lcComprobanteSelec.comprobante[0].detalle.linea[0].descripcion = string.Empty;
							if (lcComprobanteSelec.comprobante[0].resumen.codigo_moneda == "DOL")
							{
								lcComprobanteSelec.comprobante[0].detalle.linea[0].importe_total_articulo = lcComprobanteSelec.comprobante[0].resumen.importes_moneda_origen.importe_total_neto_gravado;
							}
							else
							{
								lcComprobanteSelec.comprobante[0].detalle.linea[0].importe_total_articulo = lcComprobanteSelec.comprobante[0].resumen.importe_total_neto_gravado;
							}

						}
						if (lcComprobanteSelec.comprobante[0].resumen.codigo_moneda == "DOL")
						{
							lcComprobanteSelec.comprobante[0].resumen.cant_alicuotas_ivaSpecified = false;
							lcComprobanteSelec.comprobante[0].resumen.importe_total_factura = 0;
							lcComprobanteSelec.comprobante[0].resumen.impuesto_liq = 0;
							lcComprobanteSelec.comprobante[0].resumen.importe_total_neto_gravado = 0;
							lcComprobanteSelec.comprobante[0].resumen.importe_total_concepto_no_gravado = 0;
							lcComprobanteSelec.comprobante[0].resumen.impuesto_liq_rni = 0;
							lcComprobanteSelec.comprobante[0].resumen.importe_operaciones_exentas = 0;

						}
						lcComprobanteSelec.cabecera_lote.id_lote = Convert.ToInt64(DateTime.Now.ToString("yyyyMMddHHmmss"));
						lcComprobanteSelec.cabecera_lote.fecha_envio_lote = DateTime.Now.ToString("yyyyMMdd") + " " + DateTime.Now.ToString("HHmmss");
                        LoteXML = ArmarLoteXML(lcComprobanteSelec);
                        //Definir ruta y nombre del archivo.
						string archPath = System.Configuration.ConfigurationManager.AppSettings["ArchPath"];
                        FileStream fs = File.Create(@archPath + "\\efact-c-contingencia.xml");
                        System.Text.Encoding codificador;
                        codificador = System.Text.Encoding.GetEncoding("iso-8859-1");
                        fs.Write(codificador.GetBytes(LoteXML), 0, LoteXML.Length);
                        fs.Close();
                        MessageBox.Show("Lote XML generado satisfactoriamente", "NOTIFICACION", MessageBoxButtons.OK);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message, "NOTIFICACION", MessageBoxButtons.OK);
                        //Guardar el ex.InnerException si tiene contenido para tener mas detalle del problema.
                    }
                    //Actualizar lote
                    //ms = new MemoryStream();
                    //XmlizedString = null;
                    //writer = new XmlTextWriter(ms, System.Text.Encoding.GetEncoding("ISO-8859-1"));
                    //x = new System.Xml.Serialization.XmlSerializer(Lc.GetType());
                    //x.Serialize(writer, Lc);
                    //ms = (MemoryStream)writer.BaseStream;
                    //XmlizedString = RN.Tablero.ByteArrayToString(ms.ToArray());
                    //ms.Close();
                    //Lote.LoteXmlIF = XmlizedString;
                }
            }
            catch (Exception ex)
            {
                Microsoft.ApplicationBlocks.ExceptionManagement.ExceptionManager.Publish(ex);
            }
        }