private void InsertaBloqueEnActa(odts.PresupuestoVentaBloque bloque) { //foreach (odts.DetalleModelo d in bloque.Detalle) //{ // odts.DetalleModelo d1 = d.Copia(CalcularNuevaLinea()); // this.tlvActa.AddObject(d1); //} }
private bool EsArticuloDuplicado(int artiId1, odts.DetalleModelo modelo) { foreach (odts.DetalleDeterminacion d in modelo.Determinaciones) { if (d.ArtiId1 == artiId1) { return true; } } return false; }
// Guarda la linea de un bloque public static void GuardarLineaBloque(string docuId, string numero, int bloqueId, odts.PresupuestoVentaDetalle linea, int numLinea) { using (SqlConnection cn = new SqlConnection(ConfigurationSettings.AppSettings["conexionQ"])) { SqlCommand cmd = new SqlCommand( @"INSERT INTO PRESUPUESTOSV_LI (DOCU_ID,PRESUV_ID,PRESUVL_LINEA,PRESUVL_SUBLINEA,LIDO_ID,PRESUVL_DESCRIPCION,PRESUVL_CANTIDAD, PRESUVL_PRECIO,GRDE_ID,UNID_ID,ESTDOC_ID,DOCU_ID_ORIGEN,DOCU_NUMERO_ORIGEN,DOCU_LINEA_ORIGEN, DOCU_SUBLINEA_ORIGEN,PRESUVL_FLUJOC,PRESUVL_FLUJOL,ARTI_ID1,COMP_ID, ARTI_DETERMINACIONES, ARTI_PNT_METODOLOGIA, BLOQUE_ID) VALUES( @DOCU_ID,@PRESUV_ID,@PRESUVL_LINEA,@PRESUVL_SUBLINEA,@LIDO_ID,@PRESUVL_DESCRIPCION,@PRESUVL_CANTIDAD, @PRESUVL_PRECIO,@GRDE_ID,@UNID_ID,@ESTDOC_ID,@DOCU_ID_ORIGEN,@DOCU_NUMERO_ORIGEN,@DOCU_LINEA_ORIGEN, @DOCU_SUBLINEA_ORIGEN,@PRESUVL_FLUJOC,@PRESUVL_FLUJOL,@ARTI_ID1,@COMP_ID, @ARTI_DETERMINACIONES, @ARTI_PNT_METODOLOGIA, @BLOQUE_ID) ", cn); cmd.Parameters.AddWithValue("@DOCU_ID", docuId); cmd.Parameters.AddWithValue("@PRESUV_ID", numero); cmd.Parameters.AddWithValue("@PRESUVL_LINEA", numLinea); cmd.Parameters.AddWithValue("@PRESUVL_SUBLINEA", linea.Sublinea); cmd.Parameters.AddWithValue("@LIDO_ID", linea.TipoLinea); cmd.Parameters.AddWithValue("@PRESUVL_DESCRIPCION", linea.DetalleDescripcion); cmd.Parameters.AddWithValue("@PRESUVL_CANTIDAD", linea.Cantidad); cmd.Parameters.AddWithValue("@PRESUVL_PRECIO", linea.Precio); if (linea.DescuentoId.HasValue) { cmd.Parameters.AddWithValue("@GRDE_ID", linea.DescuentoId.Value); } else { cmd.Parameters.AddWithValue("@GRDE_ID", DBNull.Value); } cmd.Parameters.AddWithValue("@UNID_ID", linea.UnidadId); cmd.Parameters.AddWithValue("@ESTDOC_ID", linea.Estado); cmd.Parameters.AddWithValue("@DOCU_ID_ORIGEN", DBNull.Value); cmd.Parameters.AddWithValue("@DOCU_NUMERO_ORIGEN", DBNull.Value); cmd.Parameters.AddWithValue("@DOCU_LINEA_ORIGEN", DBNull.Value); cmd.Parameters.AddWithValue("@DOCU_SUBLINEA_ORIGEN", DBNull.Value); cmd.Parameters.AddWithValue("@PRESUVL_FLUJOC", "1"); cmd.Parameters.AddWithValue("@PRESUVL_FLUJOL", "1"); cmd.Parameters.AddWithValue("@ARTI_ID1", linea.ArtiId1); cmd.Parameters.AddWithValue("@COMP_ID", 2); if (linea.ArtiDeterminaciones == null) cmd.Parameters.AddWithValue("@ARTI_DETERMINACIONES", string.Empty); else cmd.Parameters.AddWithValue("@ARTI_DETERMINACIONES", linea.ArtiDeterminaciones); if (linea.ArtiPNTMetodologia == null) cmd.Parameters.AddWithValue("@ARTI_PNT_METODOLOGIA", string.Empty); else cmd.Parameters.AddWithValue("@ARTI_PNT_METODOLOGIA", linea.ArtiPNTMetodologia); cmd.Parameters.AddWithValue("@BLOQUE_ID", bloqueId); cmd.CommandType = CommandType.Text; cn.Open(); if (cmd.ExecuteNonQuery() > 0) { } cn.Close(); } }
public static void GetDatosArticulo(odts.PresupuestoVentaDetalle detalle, int artiId1, int clieId) { //exec ARTICULOS_SEL_LINEAS1 @TIPO=0,@USUARIO='AL',@ARTI_ID='PLA000000000002',@CLIE_ID=3018 using (SqlConnection cn = new SqlConnection(ConfigurationSettings.AppSettings["conexionQ"])) { SqlCommand cmd = new SqlCommand( @"ARTICULOS_SEL_LINEAS3", cn); cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@TIPO", 0); cmd.Parameters.AddWithValue("@USUARIO", _USU_ID); cmd.Parameters.AddWithValue("@ARTI_ID", artiId1); cmd.Parameters.AddWithValue("@CLIE_ID", clieId); cn.Open(); SqlDataReader reader = cmd.ExecuteReader(); if (reader.HasRows) { while (reader.Read()) { detalle.UnidadId = Utilidades.UtilsBD.DBValueToRequiredValue<string>(reader["UNID_ID"]); detalle.ArtiId1 = Utilidades.UtilsBD.DBValueToRequiredValue<int>(reader["ARTI_ID1"]); detalle.ComportamientoIVA = Utilidades.UtilsBD.DBValueToRequiredValue<int>(reader["COMP_ID"]); } } cn.Close(); } }
// Obtiene el precio y descuento de un articulo para un cliente public static void GetPrecioArticuloByCliente(odts.PresupuestoVentaDetalle detalle, int artiId1, int clieId, string docuId) { using (SqlConnection cn = new SqlConnection(ConfigurationSettings.AppSettings["conexionQ"])) { SqlCommand cmd = new SqlCommand( @"CLIENTES_COND_PRECIO2", cn); cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@TIPO", 0); cmd.Parameters.AddWithValue("@USUARIO", _USU_ID); cmd.Parameters.AddWithValue("@INTER_ID", clieId); cmd.Parameters.AddWithValue("@FECHA", DateTime.Now.ToString("yyyy-MM-dd")); cmd.Parameters.AddWithValue("@ARTI_ID1", artiId1); cmd.Parameters.AddWithValue("@DOCU_ID", docuId); cn.Open(); SqlDataReader reader = cmd.ExecuteReader(); if (reader.HasRows) { while (reader.Read()) { detalle.Precio = Utilidades.UtilsBD.DBValueToRequiredValue<decimal>(reader[1]); detalle.DescuentoId = Utilidades.UtilsBD.DBValueToOptionalValue<int>(reader[2]); } } cn.Close(); } }
public void InsertarDetalle(string documento, string numero, odts.PresupuestoVentaDetalle pvd) { this.PedidovDetalleDataCtx.Q2_PEDIDOSV_LI_INS(documento, numero, pvd.Linea, pvd.Sublinea, pvd.TipoLinea, pvd.DetalleDescripcion, pvd.Cantidad, pvd.Precio, pvd.DescuentoId, pvd.Estado, pvd.UnidadId, string.Empty, string.Empty, null, null, string.Empty, string.Empty, pvd.ComportamientoIVA, pvd.ArtiId1, string.Empty, string.Empty); }