private void btn_precios_Click(object sender, EventArgs e) { try { String modd = ""; sys_moduloBL BL = new sys_moduloBL(); tb_sys_modulo BE = new tb_sys_modulo(); DataTable dt = new DataTable(); BE.dominioid = _dominioid; BE.moduloid = _moduloid; dt = BL.GetAll(VariablesPublicas.EmpresaID, BE).Tables[0]; if (dt.Rows.Count > 0) { if (dt.Rows[0]["moduloshort"].ToString().Trim().Length == 2) { modd = dt.Rows[0]["moduloshort"].ToString().Trim(); Ayudas.Form_help_productoprecio frmayuda = new Ayudas.Form_help_productoprecio(); frmayuda.tipoo = "sql"; //sql,tabla frmayuda.titulo = " << *** Ayudas *** >>"; frmayuda.sqlquery = "SELECT tb1.productid "+ ", tb2.productname "+ ", SUM(IIF(mdet.almacaccionid = '10',mdet.cantidad * 1,mdet.cantidad *-1)) AS stock " + ", tb1.costopromed " + ", tb1.valoractual as StockValor " + ", tb1.costoultimo as CostoSoles " + ", tb3.compra as Tcamb" + ", cast(tb1.costoultimo/cast(tb3.compra as decimal(10,4)) as decimal (10,4))as CostoDolar "+ " FROM tb_" + modd + "_local_stock as tb1 "; frmayuda.sqlinner = "INNER JOIN tb_" + modd + "_productos as tb2 ON tb1.productid = tb2.productid " + "INNER JOIN tb_tipocambio as tb3 ON tb3.fecha = CONVERT(date, GETDATE(), 103) " + "LEFT JOIN tb_" + modd + "_movimientosdet mdet ON tb2.productid = mdet.productid "; frmayuda.sqlwhere = "WHERE " + " tb1.local = '" + _local + "'" + " and tb2.status= 0 "; frmayuda.sqland = " and "; frmayuda.sqlgroupby = " GROUP BY tb1.productid " + ", tb2.productname " + ", tb1.costopromed " + ", tb1.valoractual " + ", tb1.costoultimo " + ", tb3.compra " + ", tb1.costoultimo "; frmayuda.criteriosbusqueda = new string[] { "PRODUCTO", "CODIGO" }; frmayuda.columbusqueda = "tb2.productname,tb1.productid"; frmayuda.returndatos = "0,1"; frmayuda.Owner = this; frmayuda.ShowDialog(); } } } catch (Exception ex) { throw ex; } }
private void btn_precios_Click(object sender, EventArgs e) { try { var modd = string.Empty; var BL = new sys_moduloBL(); var BE = new tb_sys_modulo(); var dt = new DataTable(); BE.dominioid = dominioid; //VariablesPublicas.Dominioid; BE.moduloid = moduloid; //VariablesPublicas.Moduloid; dt = BL.GetAll(VariablesPublicas.EmpresaID, BE).Tables[0]; if (dt.Rows.Count > 0) { if (dt.Rows[0]["moduloshort"].ToString().Trim().Length == 2) { modd = dt.Rows[0]["moduloshort"].ToString().Trim(); var frmayuda = new Ayudas.Form_help_productoprecio(); frmayuda.tipoo = "sql"; frmayuda.titulo = " << *** Ayudas *** >>"; frmayuda.sqlquery = "SELECT tb1.productid " + ", tb2.productname " + ", tb1.stock " + ", tb1.costopromed " + ", tb1.valoractual as StockValor " + ", tb1.costoultimo as CostoSoles " + ", tb3.compra as Tcamb" + ", cast(tb1.costoultimo/cast(tb3.compra as decimal(10,4)) as decimal (10,4))as CostoDolar " + " FROM tb_" + modd + "_local_stock as tb1 "; frmayuda.sqlinner = "INNER JOIN tb_" + modd + "_productos as tb2 ON tb1.productid = tb2.productid " + "INNER JOIN tb_tipocambio as tb3 ON tb3.fecha = CONVERT(date, GETDATE(), 103) "; frmayuda.sqlwhere = "Where " + //"tb1.local = '" + VariablesPublicas.Local + "'" + "tb1.local = '" + local + "'" + "and tb2.status= 0 "; frmayuda.sqland = "and"; frmayuda.criteriosbusqueda = new string[] { "PRODUCTO", "CODIGO" }; frmayuda.columbusqueda = "tb2.productname,tb1.productid"; frmayuda.returndatos = "0,1"; frmayuda.Owner = this; frmayuda.ShowDialog(); } } } catch (Exception ex) { throw ex; } }