public static void GetDocumentoFromMove(int moveId) { MySqlConnection connection = null; connection = new MySqlConnection(ConnectionConfig.connectionString); Console.WriteLine(ConnectionConfig.connectionString); MySqlCommand command = connection.CreateCommand(); command.CommandText = "SELECT " + "it_tmove.Docu_type_ID AS 'TipoDocumento', " + //Receptor "fl_tcustomer.TaxExemptNo, " + "fl_tcustomer.SS_NO, " + "idtypes.Codigo AS 'Tipo_Doc_Receptor', " + "Company_Name, " + "Cust_name, " + "it_tmove.Move_wic_Value, " + "it_tmove.Money_Conv, " + "it_tmove.Ticket_count AS 'IdDocumento', " + "it_tmove.Move_Date AS 'FechaEmision', " + "SUM(it_tdetamove.Move_Deta_Tax_Value) AS 'TotalIgv', " + "SUM(it_tdetamove.Move_Deta_Tax2_Value) AS 'TotalIsc', " + "SUM((it_tdetamove.Move_Deta_Q * it_tdetamove.Move_Deta_price)) AS 'TotalVenta' " + "FROM it_tmove " + "LEFT JOIN fl_tcustomer ON it_tmove.Cust_Id = fl_tcustomer.Cust_ID " + "INNER JOIN it_tdetamove ON it_tdetamove.Move_Deta_Move_ID = it_tmove.Move_ID " + "LEFT JOIN idtypes ON idtypes.TYPE_ID = fl_tcustomer.IDType " + "WHERE it_tmove.Move_ID = " + moveId + " " + "GROUP BY NULL;"; MySqlDataReader Reader; Console.WriteLine(command.CommandText); connection.Open(); Reader = command.ExecuteReader(); int i = 0; while (Reader.Read()) { string TipoDocumento = HelpersDatabase.GetString(Reader, "TipoDocumento"); string TaxExemptNo = HelpersDatabase.GetString(Reader, "TaxExemptNo"); string SS_NO = HelpersDatabase.GetString(Reader, "SS_NO"); string Tipo_Doc_Receptor = HelpersDatabase.GetString(Reader, "Tipo_Doc_Receptor"); string Company_Name = HelpersDatabase.GetString(Reader, "Company_Name"); string Cust_name = HelpersDatabase.GetString(Reader, "Cust_name"); decimal PrecioUnitario = HelpersDatabase.GetInt(Reader, "Move_wic_Value"); decimal Money_Conv = HelpersDatabase.GetInt(Reader, "Money_Conv"); string IdDocumento = HelpersDatabase.GetString(Reader, "IdDocumento"); string FechaEmision = HelpersDatabase.GetDate(Reader, "FechaEmision"); string HoraEmision = HelpersDatabase.GetTime(Reader, "FechaEmision"); decimal TotalIgv = Reader.GetInt32("TotalIgv"); decimal TotalIsc = Reader.GetInt32("TotalIsc"); decimal TotalVenta = Reader.GetInt32("TotalVenta"); string NombreLegal; string NroDocumento; DetasPlusTaxes detasPlusTaxes = GetDETFromMove(moveId); if (string.IsNullOrEmpty(Company_Name) && string.IsNullOrEmpty(TaxExemptNo)) { NombreLegal = Cust_name; NroDocumento = SS_NO; } else { NombreLegal = Company_Name; NroDocumento = TaxExemptNo; } string Moneda; if (PrecioUnitario == 0 && Money_Conv == 0) { Moneda = "PEN"; } else { Moneda = "USD"; } IDE iDE = new IDE() { numeracion = IdDocumento, fechaEmision = FechaEmision, horaEmision = HoraEmision, codTipoDocumento = TipoDocumento, tipoMoneda = Moneda, //numeroOrdenCompra = "", //fechaVencimiento = "", }; EMI eMI = new EMI() { //codigoPais = "", //correoElectronico = "", tipoDocId = "6",//falta departamento = Settings.Default.emDepartamento, direccion = Settings.Default.emDireccion, distrito = Settings.Default.emDistrito, nombreComercial = Settings.Default.emNombreComercial, numeroDocId = Settings.Default.emRUC, provincia = Settings.Default.emProvincia, razonSocial = Settings.Default.emNombreLegal, //telefono = "", ubigeo = Settings.Default.emUbigeo, urbanizacion = Settings.Default.emUrbanizacion, }; DRF dRF = new DRF() { numeroDocRelacionado = "", tipoDocRelacionado = "", }; CAB cAB = new CAB() { gravadas = new Gravadas() { codigo = "1002", totalVentas = "" }, inafectas = new Inafectas() { codigo = "1004", totalVentas = "" }, importeTotal = TotalVenta.ToString(), leyenda = new List <Leyenda>() { new Leyenda() { codigo = "1000", descripcion = Conversores.NumeroALetras(TotalVenta) } }, tipoOperacion = "01", totalImpuestos = new List <TotalImpuesto>() { new TotalImpuesto() { idImpuesto = "1000", montoImpuesto = TotalIgv.ToString() }, //IGV new TotalImpuesto() { idImpuesto = "2000", montoImpuesto = TotalIsc.ToString() } //ISC } }; REC rEC = new REC() { //codigoPais = "", //correoElectronico = "", //departamento = "", //direccion = "", //distrito = "", numeroDocId = NroDocumento, //provincia = "", razonSocial = NombreLegal, //telefono = "", tipoDocId = Tipo_Doc_Receptor, }; //GetDETFromMove(moveId), string output; if (TipoDocumento == "1") { Factura fac = new Factura() { IDE = iDE, EMI = eMI, REC = rEC, //DRF = , CAB = cAB, DET = GetDETFromMove(moveId).DET, //ADI }; output = JsonConvert.SerializeObject(fac, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }); } else { Boleta bol = new Boleta() { IDE = iDE, EMI = eMI, REC = rEC, //DRF = , CAB = cAB, DET = GetDETFromMove(moveId).DET, //ADI }; output = JsonConvert.SerializeObject(bol, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore, }); } Console.WriteLine(output); } Reader.Close(); }
public string Literal_Post([FromHeader] int numero) { return(Conversores.NumeroALetras(numero)); }
public string Literal_Get(int numero) { return(Conversores.NumeroALetras(numero)); }
public string Literalget(int numero) { return Conversores.NumeroALetras(numero); }
public string LiteralPost([FromHeader] int numero) //COn el Post siempre FromHeader { return(Conversores.NumeroALetras(numero)); }
public string literal1([FromHeader] int numero) { string cadena = Conversores.NumeroALetras(numero); return(cadena); }