protected override void SelectLineTaxAction()
        {
            if (Lines_DGW.CurrentRow == null)
            {
                return;
            }
            if (Lines_DGW.CurrentRow.DataBoundItem == null)
            {
                return;
            }

            OutputInvoiceLine item = Lines_DGW.CurrentRow.DataBoundItem as OutputInvoiceLine;

            ImpuestoSelectForm form = new ImpuestoSelectForm(this);

            if (form.ShowDialog(this) == DialogResult.OK)
            {
                ImpuestoInfo source = (ImpuestoInfo)form.Selected;

                item.OidImpuesto = source.Oid;
                item.PImpuestos  = source.Porcentaje;

                _entity.CalculateTotal();
            }
        }
예제 #2
0
        private void ImpuestoVenta_BT_Click(object sender, EventArgs e)
        {
            ImpuestoSelectForm form = new ImpuestoSelectForm(this);

            if (form.ShowDialog(this) == DialogResult.OK)
            {
                ImpuestoInfo item = form.Selected as ImpuestoInfo;
                _entity.SetImpuesto(item, ETipoSerie.Venta);
                ImpuestoVenta_TB.Text = _entity.ImpuestoVenta;
            }
        }
        protected virtual void SelectImpuestoAction()
        {
            ImpuestoSelectForm form = new ImpuestoSelectForm(this);

            if (form.ShowDialog(this) == DialogResult.OK)
            {
                ImpuestoInfo source = (ImpuestoInfo)form.Selected;

                _entity.OidImpuesto = source.Oid;
                _entity.PImpuestos  = source.Porcentaje;
                _entity.CalculaTotal();
            }
        }
예제 #4
0
        public virtual void SetImpuesto(ImpuestoInfo source)
        {
            if (source == null)
            {
                OidImpuesto    = 0;
                _base.Impuesto = moleQule.Common.Structs.EnumText <ETipoImpuesto> .GetLabel(ETipoImpuesto.Defecto);

                _base.PImpuesto = 0;
            }
            else
            {
                OidImpuesto     = source.Oid;
                _base.Impuesto  = source.Nombre;
                _base.PImpuesto = source.Porcentaje;
            }
        }
예제 #5
0
        protected override void SelectLineTaxAction()
        {
            if (Lines_BS.Current == null)
            {
                return;
            }

            InputDeliveryLine item = Lines_BS.Current as InputDeliveryLine;

            ImpuestoSelectForm form = new ImpuestoSelectForm(this);

            if (form.ShowDialog(this) == DialogResult.OK)
            {
                ImpuestoInfo source = (ImpuestoInfo)form.Selected;

                item.OidImpuesto = source.Oid;
                item.PImpuestos  = source.Porcentaje;
            }
        }
        protected override void SelectImpuestoLineaAction()
        {
            if (Datos_Lineas.Current == null)
            {
                return;
            }

            LineaPedidoProveedor item = Datos_Lineas.Current as LineaPedidoProveedor;

            ImpuestoSelectForm form = new ImpuestoSelectForm(this);

            if (form.ShowDialog(this) == DialogResult.OK)
            {
                ImpuestoInfo source = (ImpuestoInfo)form.Selected;

                item.OidImpuesto = source.Oid;
                item.PImpuestos  = source.Porcentaje;

                RefreshLineas();
            }
        }
        protected override void SelectImpuestoLineaAction()
        {
            if (Datos_Concepto.Current == null)
            {
                return;
            }

            BudgetLine item = Datos_Concepto.Current as BudgetLine;

            ImpuestoSelectForm form = new ImpuestoSelectForm(this);

            if (form.ShowDialog(this) == DialogResult.OK)
            {
                ImpuestoInfo source = (ImpuestoInfo)form.Selected;

                item.OidImpuesto = source.Oid;
                item.PImpuestos  = source.Porcentaje;

                _entity.CalculaTotal();
            }
        }
        protected override void SelectImpuestoLineaAction()
        {
            if (Datos_Productos.Current == null)
            {
                return;
            }

            ProductoProveedor item = (ProductoProveedor)Datos_Productos.Current;

            ImpuestoSelectForm form = new ImpuestoSelectForm(this);

            if (form.ShowDialog(this) == DialogResult.OK)
            {
                ImpuestoInfo impuesto = form.Selected as ImpuestoInfo;

                item.OidImpuesto = impuesto.Oid;
                item.Impuesto    = impuesto.Nombre;
                item.PImpuestos  = impuesto.Porcentaje;

                Datos_Productos.ResetBindings(false);
            }
        }
        protected override void SelectImpuestoLineaAction()
        {
            if (Datos_Lineas.Current == null)
            {
                return;
            }

            LineaPedido item = Datos_Lineas.Current as LineaPedido;

            ImpuestoSelectForm form = new ImpuestoSelectForm(this);

            if (form.ShowDialog(this) == DialogResult.OK)
            {
                ImpuestoInfo source = (ImpuestoInfo)form.Selected;

                item.OidImpuesto = source.Oid;
                item.PImpuestos  = source.Porcentaje;
                _entity.CalculateTotal();

                ControlsMng.UpdateBinding(Lineas_DGW);
            }
        }
        public List <CuentaResumen> GetCuentasAndImpuestosA3()
        {
            try
            {
                List <CuentaResumen> list      = new List <CuentaResumen>();
                ProductList          productos = ProductList.GetList(false, true);
                FamiliaList          familias  = FamiliaList.GetList(false, true);
                ImpuestoList         impuestos = ImpuestoList.GetList(false);
                bool        nuevo;
                ProductInfo producto;
                FamiliaInfo familia;
                string      cuenta;
                string      nombre;

                foreach (OutputInvoiceLineInfo item in _conceptos)
                {
                    ImpuestoResumen impuesto = new ImpuestoResumen();

                    nuevo    = true;
                    producto = productos.GetItem(item.OidProducto);
                    familia  = familias.GetItem(producto.OidFamilia);


                    cuenta = (producto.CuentaContableVenta == string.Empty) ? familia.CuentaContableVenta : producto.CuentaContableVenta;
                    nombre = (producto.CuentaContableVenta == string.Empty)
                            ? familia.Codigo + " " + familia.Nombre
                            : producto.Codigo + " " + producto.Nombre;

                    //Agrupamos los conceptos por cuentas contables
                    for (int i = 0; i < list.Count; i++)
                    {
                        CuentaResumen cr = list[i];

                        //Tiene prioridad la cuenta contable del producto
                        if (producto.CuentaContableVenta != string.Empty)
                        {
                            if ((cr.CuentaContable == producto.CuentaContableVenta) && (cr.Impuesto != null && cr.Impuesto.OidImpuesto == item.OidImpuesto))
                            {
                                cr.Importe                += item.PDescuento > 0 ? item.BaseImponible : item.Subtotal;
                                cr.Impuesto.Importe       += item.Impuestos;
                                cr.Impuesto.BaseImponible += item.PDescuento > 0 ? item.BaseImponible : item.Subtotal;
                                list[i] = cr;
                                nuevo   = false;
                                break;
                            }
                        }
                        //Luego la de la familia
                        else if ((cr.CuentaContable == familia.CuentaContableVenta) && (cr.Impuesto != null && cr.Impuesto.OidImpuesto == item.OidImpuesto))
                        {
                            cr.Importe                += item.PDescuento > 0 ? item.BaseImponible : item.Subtotal;
                            cr.Impuesto.Importe       += item.Impuestos;
                            cr.Impuesto.BaseImponible += item.PDescuento > 0 ? item.BaseImponible : item.Subtotal;
                            list[i] = cr;
                            nuevo   = false;
                            break;
                        }
                    }

                    if (nuevo)
                    {
                        CuentaResumen new_cr = new CuentaResumen
                        {
                            OidFamilia     = producto.OidFamilia,
                            Importe        = item.PDescuento > 0 ? item.BaseImponible : item.Subtotal,
                            CuentaContable = cuenta,
                            Nombre         = nombre,
                        };

                        if (item.Impuestos != 0)
                        {
                            ImpuestoInfo imp = null;

                            if (item.OidImpuesto != 0)
                            {
                                imp = impuestos.GetItem(item.OidImpuesto);
                            }
                            else
                            {
                                imp = impuestos.GetItemByProperty("Porcentaje", item.PImpuestos);
                            }

                            new_cr.Impuesto = new ImpuestoResumen
                            {
                                OidImpuesto           = item.OidImpuesto,
                                BaseImponible         = item.PDescuento > 0 ? item.BaseImponible : item.Subtotal,
                                Importe               = item.Impuestos,
                                SubtipoFacturaEmitida = imp.CodigoImpuestoA3Emitida,
                                Porcentaje            = item.PImpuestos,
                            };
                        }
                        //else
                        //{
                        //    new_cr.Impuesto = new ImpuestoResumen
                        //    {
                        //        OidImpuesto = item.OidImpuesto,
                        //        BaseImponible = 0,
                        //        Importe = 0
                        //    };
                        //}

                        list.Add(new_cr);
                    }
                }

                return(list);
            }
            catch
            {
                throw new iQException(String.Format(Resources.Messages.ERROR_FACTURA_CUENTA, NFactura, Cliente));
            }
        }
        /// <summary>
        /// FORMATO: 9999999|G|01/10/2009||VENTAS DIA|4300000001|||||||||VENTAS P.S. DEL DIA|D| |37800| |7050000001|00000|00000|00000|4|001| |36000|500| |1800| |0|4777000000|0| | |0|0| |0| |0| | | | |0|0| |0| |0| | | | |0|0| |0| |0| | | | |0|0| |0| |0| | | | |0|0| |0| |0| | | | | | | | | | |1234| | | |0
        /// </summary>
        /// <param name="factura"></param>
        protected override void BuildOutputInvoiceAccountingEntry(OutputInvoiceInfo factura, LineaRegistro lr)
        {
            ClienteInfo titular = _clients.GetItem(factura.OidCliente);

            if (titular.CuentaContable == string.Empty)
            {
                throw new iQException("El cliente nº " + titular.NumeroClienteLabel + " (" + titular.Nombre + ") no tiene cuenta contable asociada");
            }

            string apunte      = string.Empty;
            string descripcion = "Fra. " + factura.NFactura + " (" + factura.Cliente + ")";

            string tipo    = (factura.Rectificativa) ? "H" : "D";
            string signo   = (factura.Rectificativa) ? "-" : "+";
            string importe = factura.Total.ToString().Replace(".", string.Empty);

            //apunte en la cuenta del cliente
            apunte += AddValue(_config.Empresa);                                /*CENTRO DE TRABAJO*/
            apunte += AddValue("S");                                            /*TIPO DE REGISTRO*/
            apunte += AddValue(factura.Fecha.ToShortDateString());              /*FECHA*/
            apunte += AddValue(factura.NumeroSerie);                            /*Nº SERIE DOCUMENTO*/
            apunte += AddValue(factura.NFactura);                               /*DOCUMENTO*/
            apunte += AddValue(titular.CuentaContable);                         /*CUENTA*/
            apunte += AddEmptyValue(8);                                         /*SIN USO*/
            apunte += AddValue(descripcion);                                    /*DESCRIPCION*/
            apunte += AddValue(tipo.ToString());                                /*TIPO: DEBE=1, HABER=2*/
            apunte += AddValue(signo);                                          /*SIGNO*/
            apunte += AddValue(importe);                                        /*IMPORTE*/
            apunte += AddValue(_accounting_entry.ToString());                   /*ASIENTO*/
            apunte += AddEmptyValue(73);                                        /*SIN USO*/
            apunte += AddValue(_config.CentroTrabajo);                          /*CENTRO TRABAJO*/
            apunte += AddEmptyValue(3);                                         /*SIN USO*/

            _export_file.WriteLine(apunte);

            List <CuentaResumen> cuentas = factura.GetCuentas();
            FamiliaInfo          familia;

            foreach (CuentaResumen cr in cuentas)
            {
                apunte = string.Empty;

                familia = _families.GetItem(cr.OidFamilia);

                if (familia == null)
                {
                    throw new iQException("Factura " + factura.NFactura + " con familia a nulo");
                }

                if (cr.CuentaContable == string.Empty)
                {
                    throw new iQException("La familia nº " + familia.Codigo + " (" + familia.Nombre + ") no tiene cuenta contable (venta) asociada");
                }

                tipo    = (factura.Rectificativa) ? "D" : "H";
                signo   = (factura.Rectificativa) ? "+" : "-";
                importe = cr.Importe.ToString().Replace(".", string.Empty);

                //apunte en la cuenta de venta
                apunte += AddValue(_config.Empresa);                                    /*CODIGO DE EMPRESA*/
                apunte += AddValue("G");                                                /*TIPO DE REGISTRO*/
                apunte += AddValue(factura.Fecha.ToShortDateString());                  /*FECHA*/
                apunte += AddValue(factura.NumeroSerie);                                /*Nº SERIE DOCUMENTO*/
                apunte += AddValue(factura.NFactura);                                   /*DOCUMENTO*/
                apunte += AddValue(cr.CuentaContable);                                  /*CUENTA*/
                apunte += AddEmptyValue(8);                                             /*SIN USO*/
                apunte += AddValue(descripcion);                                        /*DESCRIPCION*/
                apunte += AddValue(tipo.ToString());                                    /*TIPO: DEBE=1, HABER=2*/
                apunte += AddValue(signo);                                              /*SIGNO*/
                apunte += AddValue(importe);                                            /*IMPORTE*/
                apunte += AddValue(_accounting_entry.ToString());                       /*ASIENTO*/
                apunte += AddEmptyValue(73);                                            /*SIN USO*/
                apunte += AddValue(_config.CentroTrabajo);                              /*CENTRO TRABAJO*/
                apunte += AddEmptyValue(3);                                             /*SIN USO*/

                _export_file.WriteLine(apunte);
            }

            // Apuntes en las cuentas de Impuestos

            List <ImpuestoResumen> impuestos = new List <ImpuestoResumen>();

            foreach (DictionaryEntry impuesto in factura.GetImpuestos())
            {
                impuestos.Add((ImpuestoResumen)impuesto.Value);
            }

            foreach (ImpuestoResumen ir in impuestos)
            {
                if (ir.Importe == 0)
                {
                    continue;
                }

                apunte = string.Empty;

                ImpuestoInfo impuesto = _taxes.GetItem(ir.OidImpuesto);

                if (impuesto == null)
                {
                    throw new iQException("Factura " + factura.NFactura + " con impuesto a nulo");
                }

                if (impuesto.CuentaContableSoportado == string.Empty)
                {
                    throw new iQException("El impuesto '" + impuesto.Nombre + "' no tiene cuenta contable (repercutido) asociada");
                }

                tipo    = (factura.Rectificativa) ? "D" : "H";
                signo   = (factura.Rectificativa) ? "+" : "-";
                importe = ir.Importe.ToString().Replace(".", string.Empty);

                //apunte en la cuenta del impuesto
                apunte += AddValue(_config.Empresa);                                    /*CODIGO DE EMPRESA*/
                apunte += AddValue("G");                                                /*TIPO DE REGISTRO*/
                apunte += AddValue(factura.Fecha.ToShortDateString());                  /*FECHA*/
                apunte += AddValue(factura.NumeroSerie);                                /*Nº SERIE DOCUMENTO*/
                apunte += AddValue(factura.NFactura);                                   /*DOCUMENTO*/
                apunte += AddValue(impuesto.CuentaContableSoportado);                   /*CUENTA*/
                apunte += AddEmptyValue(8);                                             /*SIN USO*/
                apunte += AddValue(descripcion);                                        /*DESCRIPCION*/
                apunte += AddValue(tipo.ToString());                                    /*TIPO: DEBE=1, HABER=2*/
                apunte += AddValue(signo);                                              /*SIGNO*/
                apunte += AddValue(importe);                                            /*IMPORTE*/
                apunte += AddValue(_accounting_entry.ToString());                       /*ASIENTO*/
                apunte += AddEmptyValue(73);                                            /*SIN USO*/
                apunte += AddValue(_config.CentroTrabajo);                              /*CENTRO TRABAJO*/
                apunte += AddEmptyValue(3);                                             /*SIN USO*/

                _export_file.WriteLine(apunte);
            }
        }