private void dwcliente_SelectedValueChanged(object sender, EventArgs e) { try { //if (!(dwcliente.Focused)) return; String coordinatorSelect = dwcliente.SelectedValue.ToString(); Cursor.Current = Cursors.WaitCursor; /// Verificar que sea una selección valida if (coordinatorSelect != "-1") { /// Obtener Informacion del coordinador DataTable dtable = new DataTable(); dtable = (NotaCredito_Negocio.getCoordinatorByPk(Convert.ToDecimal(coordinatorSelect)).Tables[0]); /// Llamar la funcion que imprimira la informacion del coordinador this.paintInfoUser(dtable); /// Consultar saldos y montos en pedidos del cliente //this.ordersCustomer(Documents_Trans.getBalanceCoordById(_user._usv_co, coordinatorSelect).Tables[0]); /// Cargar el id del coordinador seleccionado /// _cliente_id = coordinatorSelect; /// this.cleanForm(); } } catch { } Cursor.Current = Cursors.Default; }
public void consultar() { Cursor.Current = Cursors.WaitCursor; try { Boolean _tipo = chkactivar.Checked; if (_tipo) { if (txtdocumento.Text.Length == 0) { MessageBox.Show("Por favor ingrese el numero de documento a consultar", Global.mensaje, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); txtdocumento.Focus(); return; } } DateTime _fechaini = dtpinicio.Value; DateTime _fechafin = dtpfinal.Value; string _doc = txtdocumento.Text; dg1.AutoGenerateColumns = false; dt = NotaCredito_Negocio.dt_consulta_notacredito(_tipo, _fechaini, _fechafin, _doc); dg1.DataSource = dt; grillaformato(dg1); //totales(dt); } catch (Exception exc) { MessageBox.Show(exc.Message, Global.mensaje, MessageBoxButtons.OK, MessageBoxIcon.Error); } Cursor.Current = Cursors.Default; }
private void inicio() { DataTable dt = this.createStructureDataTable(); dtv_grilla = new DataView(dt); Cursor.Current = Cursors.WaitCursor; DataSet dsCustomers = NotaCredito_Negocio.getCoordinators("%%"); // Enlazar datos al dropdown list encargado de mostrar la informacion de los coordinadores dwcliente.DataSource = dsCustomers.Tables[0]; dwcliente.DisplayMember = "Nombres"; dwcliente.ValueMember = "bas_id"; dwcliente.SelectedIndex = -1; dwcliente.Focus(); pninfo.Visible = false; //cargar_grilla(); formato_grilla(dg0); estado_notacredito(); Cursor.Current = Cursors.Default; calculateTotals(); lblarticuloselect.Text = "0"; }
public void addArticle(String noInvoice, String article, String size, String customer, string calidad) { pninfo.Visible = false; /// Realizar la busqueda del articulo en la factura DataTable dtArticleInvoiced = NotaCredito_Negocio.searchArticleInvoice(noInvoice, article, size, customer, calidad); /// Verificar que existan datos /// if (dtArticleInvoiced != null && dtArticleInvoiced.Rows.Count > 0) { /// DataView dv = (DataView)dtv_grilla; /// if (dv != null) { DataRow drow = dtArticleInvoiced.Rows[0]; /// DataRow newRow = dv.Table.NewRow(); /// /// Número de factura /// String noInvo = drow["idv_invoice"].ToString(); newRow["idv_invoice"] = noInvo; /// String art = drow["idv_article"].ToString(); newRow["idv_article"] = art; /// Nombre Artículo /// newRow["arv_name"] = drow["arv_name"].ToString(); /// newRow["brv_description"] = drow["brv_description"].ToString(); /// Color Artículo ; newRow["cov_description"] = drow["cov_description"].ToString(); /// Talla newRow["idv_size"] = drow["idv_size"].ToString(); newRow["calidad"] = drow["calidad"].ToString(); //newRow["idv_size"] = drow["idv_size"].ToString(); /// /// Cantidades facturadas del articulo en la misma linea Decimal qtyInvoice = Convert.ToDecimal((drow["IDN_QTY"].ToString().Equals(String.Empty)) ? "1" : (drow["IDN_QTY"].ToString())); /// Cantidades en la misma linea Decimal qtyInLine = Convert.ToDecimal(drow["totalqtyscanbereturned"]); newRow["idn_qty_line"] = qtyInLine; /// Cantidad /// newRow["idn_qty"] = 1; /// Precio de venta Decimal sellPrice = Convert.ToDecimal(drow["IDN_SELLPRICE"].ToString()); newRow["IDN_SELLPRICE"] = sellPrice; /// Comision Decimal comision = Convert.ToDecimal(drow["IDN_COMMISSION"].ToString()); /// Comision individual newRow["IDN_COMMISSION"] = comision / qtyInLine; /// Dscto Gnral Total de la factura /// /// Decimal dsctGeneralFactura = Convert.ToDecimal(drow["ion_disscount"].ToString()); /// /// Dscto Lineal /// /// El dscto lineal es una sumatoria las cantidades del articulo en la linea Decimal dctoLinealArt = Convert.ToDecimal((drow["IDN_DISSCOUNT"].ToString().Equals(String.Empty)) ? "0" : (drow["IDN_DISSCOUNT"].ToString())); /// Solo si existe descuento if (dctoLinealArt > 0) { dctoLinealArt = dctoLinealArt / qtyInvoice; } newRow["IDN_DISSCOUNT"] = dctoLinealArt; /// Flete /// /// Decimal handling = Convert.ToDecimal(drow["ihn_handling"].ToString()); /////////////////////////////////////////////////////////////////////////////////////////////////////// /// Sumar todas las cantidades que se puden devolver de este articulo /// /// Muchas veces la consulta podra devolver el mismo articulo en varias lineas, debido /// a la diferencia entre numero de linea y numero de orden entre los registros, por eso se /// debera sumar las cantidades posibles a devolver. // Decimal qtysDelArticulo = 0; /// Determinar comision para un articulo /////if (comision > 0) //// comision = Math.Round((comision / qtysDelArticulo), 2); /// /// Cantidades TOTALes en la facura Decimal cantTot = Convert.ToDecimal(drow["qtytotalinvoiced"].ToString()); /// Iva Total /// Decimal ivaTot = Convert.ToDecimal(drow["ihn_taxes"].ToString()); /// /// Base total de la facturacion /// Decimal baseFac = Convert.ToDecimal(drow["base"].ToString()); /////////////////////////////////////////////////////////////////////////////////////////////////// Decimal ivaIndividual = this.calculoIva(ivaTot, handling, dsctGeneralFactura, baseFac); /////////////////////////////////////////////////////////////////////////////////////////////////// Decimal fleteIndividual = 0; if (handling > 0) { fleteIndividual = Math.Round((handling / cantTot), 2); } /////////////////////////////////////////////////////////////////////////////////////////////////// Decimal dsctoGralIndividualizado = 0; if (dsctGeneralFactura > 0) { dsctoGralIndividualizado = Math.Round((dsctGeneralFactura / cantTot), 2); } /// Calcular el valor del iva a nivel unitario . /// Formula = (Precio venta + fleteIndividual - comision lineal a nivel unitario) * porcentIva ivaIndividual = (sellPrice + fleteIndividual - (comision / qtyInvoice) - dsctoGralIndividualizado - dctoLinealArt) * ivaIndividual; ///sellPrice* ivaIndividual; /// //newRow["TAXES"] = Math.Round(ivaIndividual, 2); newRow["TAXES"] = ivaIndividual; /// newRow["checked"] = false; /// dv.Table.Rows.Add(newRow); /// pninfo.Visible = true; lblinfo.BackColor = System.Drawing.ColorTranslator.FromHtml("#e7df65"); lblinfo.Text = " > Se ha agregado el articulo -" + article + "- en talla -" + size + "- en la factura No. -" + noInvoice + "-."; //msnMessage.LoadMessage(" > Se ha agregado el articulo -" + article + "- en talla -" + size + "- en la factura No. -" + noInvoice + "-.", UserControl.ucMessage.MessageType.Information); this.dg0.DataSource = dv; //this.GridViewArticlesToReturn.DataBind(); dtv_grilla = dv; formato_grilla(dg0); //Session[_nameSessionArtsRet] = dv; this.calculateTotals(); txtarticulo.SelectAll(); txtarticulo.Focus(); } } else { pninfo.Visible = true; lblinfo.BackColor = System.Drawing.ColorTranslator.FromHtml("#ee7749"); lblinfo.Text = " > No se puede devolver el articulo -" + article + "- en talla -" + size + "- en la factura No. -" + noInvoice + "-; busque otra factura."; } //msnMessage.LoadMessage(" > No se puede devolver el articulo -" + article + "- en talla -" + size + "- en la factura No. -" + noInvoice + "-; busque otra factura.", UserControl.ucMessage.MessageType.Error); }