public string List_insertDataACR_Flete(string Año, string Mes, string Dia) { string query = ""; Conexion con = new Conexion(); SqlCommand cmd = con.AbrirConexionSV2000_Addax(); if (cmd != null) { try { cmd.CommandText = " SELECT DDC_ID,DDC_OT_IADE, DOCC_FECHA, DDC_CANT,DDC_VU,'' PRD_NOMBRE,'Fletes' as Data " + " FROM Addax..DOCCOMPRA, Addax..DETDOCC " + " WHERE DOCC_ID=DDC_ID_DOC " + " AND DDC_PROD='FL-01-0001' " + " AND DOCC_FECHA ='" + Año + Mes + Dia + "';"; SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { query += "insert into ACR_Flete (ID_Registro,OT,Fecha_Proceso,Cantidad,CostoUnitario,CostoTotal,Estado,Fecha_Envio) " + "values(" + reader["DDC_ID"].ToString() + ",'" + reader["DDC_OT_IADE"].ToString() + "','" + Convert.ToDateTime(reader["DOCC_FECHA"].ToString()).ToString("yyyy-MM-dd") + "'," + reader["DDC_CANT"].ToString() + "," + reader["DDC_VU"].ToString() + "," + Convert.ToInt32(Convert.ToInt32(reader["DDC_CANT"].ToString()) * Convert.ToInt32(reader["DDC_VU"].ToString())).ToString() + ",0,'1900-01-01');"; } } catch { } } con.CerrarConexion(); return(query); }
public string List_insertDataACR_Encuadernacion(string Año, string Mes, string Dia) { string query = ""; Conexion con = new Conexion(); SqlCommand cmd = con.AbrirConexionSV2000_Addax(); if (cmd != null) { try { cmd.CommandText = " SELECT DDC_ID,DDC_OT_IADE,DOCC_FECHA, DDC_CANT, DDC_VU,PRD_NOMBRE ,'Encuadernación' as Data " + " FROM Addax..DOCCOMPRA,Addax..DETDOCC,Addax..PRODUCTOS,Addax..PERSONAS " + " WHERE DDC_ID_DOC=DOCC_ID " + " AND DOCC_FECHA = '" + Año + Mes + Dia + "' " + " AND PRD_CODIGO LIKE '%se-%' " + " AND DDC_PROD=PRD_CODIGO " + " and PER_RUT=DOCC_RUTPRV " + " and DOCC_TIPO='f' " + " AND PRD_UMCONS='UNIDAD' " + " and DDC_OT_IADE is not null"; SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { query += "insert into ACR_Encuadernacion (ID_Registro,OT,Proceso,Fecha_Proceso,Cantidad,CostoUnitario,Costo_Total,Estado,Fecha_Envio) " + "values(" + reader["DDC_ID"].ToString() + ",'" + reader["DDC_OT_IADE"].ToString() + "','" + reader["PRD_NOMBRE"].ToString() + "','" + Convert.ToDateTime(reader["DOCC_FECHA"].ToString()).ToString("yyyy-MM-dd") + "'," + reader["DDC_CANT"].ToString() + "," + reader["DDC_VU"].ToString() + "," + Convert.ToInt32(Convert.ToInt32(reader["DDC_CANT"].ToString()) * Convert.ToInt32(reader["DDC_VU"].ToString())).ToString() + ",0,'1900-01-01');"; } } catch { } } con.CerrarConexion(); return(query); }