commit
32ec443a19
|
@ -1,3 +1,7 @@
|
|||
v 1.10.0 [10-jul-2018]
|
||||
----------------------
|
||||
- Ahora se pueden manejar precios con cuatro decimales.
|
||||
|
||||
v 1.9.3 [08-jul-2018]
|
||||
---------------------
|
||||
- Fix: Al refacturar conceptos con descuento
|
||||
|
|
|
@ -34,12 +34,13 @@ from controllers import util
|
|||
from settings import log, DEBUG, VERSION, PATH_CP, COMPANIES, PRE, CURRENT_CFDI, \
|
||||
INIT_VALUES, DEFAULT_PASSWORD, DECIMALES, IMPUESTOS, DEFAULT_SAT_PRODUCTO, \
|
||||
CANCEL_SIGNATURE, PUBLIC, DEFAULT_SERIE_TICKET, CURRENT_CFDI_NOMINA, \
|
||||
DEFAULT_SAT_NOMINA, DECIMALES_TAX, TITLE_APP, MV
|
||||
DEFAULT_SAT_NOMINA, DECIMALES_TAX, TITLE_APP, MV, DECIMALES_PRECIOS
|
||||
|
||||
|
||||
FORMAT = '{0:.2f}'
|
||||
FORMAT3 = '{0:.3f}'
|
||||
FORMAT_TAX = '{0:.4f}'
|
||||
FORMAT_PRECIO = '{0:.4f}'
|
||||
RFC_PUBLICO = 'XAXX010101000'
|
||||
|
||||
|
||||
|
@ -233,7 +234,12 @@ def config_main():
|
|||
'escuela': False,
|
||||
'nomina': nomina,
|
||||
'timbres': 0,
|
||||
'decimales_precios': DECIMALES,
|
||||
}
|
||||
dp = util.get_bool(Configuracion.get_('chk_config_decimales_precios'))
|
||||
if dp:
|
||||
data['decimales_precios'] = DECIMALES_PRECIOS
|
||||
|
||||
if not obj is None:
|
||||
titulo = '{} - <b><font color="#610B0B">{}</font></b>'
|
||||
data['empresa'] = titulo.format(data['empresa'], obj.nombre)
|
||||
|
@ -352,6 +358,7 @@ class Configuracion(BaseModel):
|
|||
'chk_config_price_with_taxes_in_invoice',
|
||||
'chk_config_add_same_product',
|
||||
'chk_config_tax_locales_truncate',
|
||||
'chk_config_decimales_precios',
|
||||
'chk_config_anticipo',
|
||||
'chk_config_cuenta_predial',
|
||||
'chk_config_codigo_barras',
|
||||
|
@ -3893,6 +3900,10 @@ class Facturas(BaseModel):
|
|||
|
||||
def _make_xml(self, invoice, auth):
|
||||
tax_decimals = Configuracion.get_bool('chk_config_tax_decimals')
|
||||
decimales_precios = Configuracion.get_bool('chk_config_decimales_precios')
|
||||
frm_vu = FORMAT
|
||||
if decimales_precios:
|
||||
frm_vu = FORMAT_PRECIO
|
||||
tmp = 0
|
||||
emisor = Emisor.select()[0]
|
||||
certificado = Certificado.select()[0]
|
||||
|
@ -3970,7 +3981,7 @@ class Facturas(BaseModel):
|
|||
'ClaveUnidad': row.unidad,
|
||||
'Unidad': SATUnidades.get(SATUnidades.key==row.unidad).name[:20],
|
||||
'Descripcion': row.descripcion,
|
||||
'ValorUnitario': FORMAT.format(row.valor_unitario),
|
||||
'ValorUnitario': frm_vu.format(row.valor_unitario),
|
||||
'Importe': FORMAT.format(row.importe),
|
||||
}
|
||||
if row.descuento:
|
||||
|
|
|
@ -31,7 +31,7 @@ except ImportError:
|
|||
|
||||
|
||||
DEBUG = DEBUG
|
||||
VERSION = '1.9.3'
|
||||
VERSION = '1.10.0'
|
||||
EMAIL_SUPPORT = ('soporte@empresalibre.net',)
|
||||
TITLE_APP = '{} v{}'.format(TITLE_APP, VERSION)
|
||||
|
||||
|
@ -123,6 +123,7 @@ CURRENT_CFDI = '3.3'
|
|||
CURRENT_CFDI_NOMINA = '1.2'
|
||||
DECIMALES = 2
|
||||
DECIMALES_TAX = 4
|
||||
DECIMALES_PRECIOS = 4
|
||||
IMPUESTOS = {
|
||||
'ISR': '001',
|
||||
'IVA': '002',
|
||||
|
|
|
@ -66,6 +66,7 @@ var controllers = {
|
|||
$$('chk_config_price_with_taxes_in_invoice').attachEvent('onItemClick', chk_config_item_click)
|
||||
$$('chk_config_add_same_product').attachEvent('onItemClick', chk_config_item_click)
|
||||
$$('chk_config_tax_locales_truncate').attachEvent('onItemClick', chk_config_item_click)
|
||||
$$('chk_config_decimales_precios').attachEvent('onItemClick', chk_config_item_click)
|
||||
$$('chk_config_anticipo').attachEvent('onItemClick', chk_config_item_click)
|
||||
$$('chk_config_ine').attachEvent('onItemClick', chk_config_item_click)
|
||||
$$('chk_config_edu').attachEvent('onItemClick', chk_config_item_click)
|
||||
|
@ -2133,4 +2134,4 @@ function grid_emisor_cuentas_banco_on_check(row, column, state){
|
|||
success: function(text, data, xhr) {
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -176,6 +176,7 @@ function default_config(){
|
|||
cfg_invoice['with_taxes'] = values.cfdi_with_taxes
|
||||
cfg_invoice['add_same_product'] = values.cfdi_add_same_product
|
||||
cfg_invoice['tax_locales_truncate'] = values.cfdi_tax_locales_truncate
|
||||
cfg_invoice['decimales_precios'] = get_config('decimales_precios')
|
||||
if(values.cfdi_show_pedimento){
|
||||
$$('grid_details').showColumn('pedimento')
|
||||
}
|
||||
|
@ -199,7 +200,7 @@ function price_without_taxes(price, id){
|
|||
|
||||
var tasa = 1.00 + impuesto.tasa.to_float()
|
||||
if(impuesto.tipo == 'T' && impuesto.name == 'IVA'){
|
||||
final_price = (price / tasa).round(DECIMALES)
|
||||
final_price = (price / tasa).round(cfg_invoice['decimales_precios'])
|
||||
}
|
||||
}
|
||||
return final_price
|
||||
|
@ -1080,7 +1081,8 @@ function grid_details_before_edit_stop(state, editor){
|
|||
if(cfg_invoice['with_taxes']){
|
||||
var valor_unitario = price_without_taxes(parseFloat(state.value), row.id_product)
|
||||
}else{
|
||||
var valor_unitario = parseFloat(state.value).round(DECIMALES)
|
||||
//~ var valor_unitario = parseFloat(state.value).round(DECIMALES)
|
||||
var valor_unitario = parseFloat(state.value).round(cfg_invoice['decimales_precios'])
|
||||
}
|
||||
grid.blockEvent()
|
||||
state.value = valor_unitario
|
||||
|
@ -1102,7 +1104,8 @@ function grid_details_before_edit_stop(state, editor){
|
|||
return true
|
||||
}
|
||||
|
||||
descuento = descuento.round(DECIMALES)
|
||||
//~ descuento = descuento.round(DECIMALES)
|
||||
descuento = descuento.round(cfg_invoice['decimales_precios'])
|
||||
var cantidad = parseFloat(row['cantidad'])
|
||||
var valor_unitario = parseFloat(row['valor_unitario'])
|
||||
|
||||
|
|
|
@ -36,6 +36,7 @@ function configuracion_inicial(){
|
|||
|
||||
$$('cmd_update_timbres').define('badge', values.timbres)
|
||||
$$('cmd_update_timbres').refresh()
|
||||
add_config({'key': 'decimales_precios', 'value': values.decimales_precios})
|
||||
})
|
||||
|
||||
}
|
||||
|
@ -215,4 +216,4 @@ function cmd_update_timbres_click(){
|
|||
$$('cmd_update_timbres').define('badge', value)
|
||||
$$('cmd_update_timbres').refresh()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ var RFC_PUBLICO = "XAXX010101000";
|
|||
var RFC_EXTRANJERO = "XEXX010101000";
|
||||
var PAIS = "México";
|
||||
var DECIMALES = 2;
|
||||
//~ var DECIMALES_PU = 4;
|
||||
var DECIMALES_TAX = 4;
|
||||
var CLAVE_ANTICIPOS = '84111506';
|
||||
|
||||
|
@ -137,6 +138,32 @@ function get_float(value){
|
|||
}
|
||||
|
||||
|
||||
var format_decimal_2 = webix.Number.numToStr({
|
||||
groupSize: 3,
|
||||
decimalSize: 2,
|
||||
groupDelimiter: ",",
|
||||
decimalDelimiter: "."
|
||||
})
|
||||
|
||||
var format_decimal_4 = webix.Number.numToStr({
|
||||
groupSize: 3,
|
||||
decimalSize: 4,
|
||||
groupDelimiter: ",",
|
||||
decimalDelimiter: "."
|
||||
})
|
||||
|
||||
|
||||
function format_currency(value){
|
||||
var fv = ''
|
||||
if(get_config('decimales_precios') == 4){
|
||||
fv = '$ ' + format_decimal_4(value)
|
||||
}else{
|
||||
fv = '$ ' + format_decimal_2(value)
|
||||
}
|
||||
return fv
|
||||
}
|
||||
|
||||
|
||||
webix.protoUI({
|
||||
$cssName: "text",
|
||||
name: "currency",
|
||||
|
@ -154,7 +181,8 @@ webix.protoUI({
|
|||
$setValue:function(value, raw){
|
||||
this.config.raw = value
|
||||
if(!raw){
|
||||
value = webix.i18n.priceFormat(value)
|
||||
//~ value = webix.i18n.priceFormat(value)
|
||||
value = format_currency(value)
|
||||
}
|
||||
this.getInputNode().value = value
|
||||
}
|
||||
|
|
|
@ -605,6 +605,8 @@ var options_admin_otros = [
|
|||
{cols: [{maxWidth: 15},
|
||||
{view: 'checkbox', id: 'chk_config_tax_locales_truncate', labelWidth: 0,
|
||||
labelRight: 'Impuestos locales, truncar valores'},
|
||||
{view: 'checkbox', id: 'chk_config_decimales_precios', labelWidth: 0,
|
||||
labelRight: 'Precios con 4 decimales'}, {},
|
||||
]},
|
||||
{maxHeight: 20},
|
||||
{template: 'Ayudas varias', type: 'section'},
|
||||
|
|
|
@ -343,9 +343,9 @@ var grid_details_cols = [
|
|||
{id: 'cantidad', header: {text: 'Cantidad', css: 'center'}, width: 100,
|
||||
format: webix.i18n.numberFormat, css: 'right', editor: 'text'},
|
||||
{id: "valor_unitario", header:{text: 'Valor Unitario', css: 'center'},
|
||||
width: 100, format: webix.i18n.priceFormat, css: 'right', editor: 'text'},
|
||||
width: 100, format: format_currency, css: 'right', editor: 'text'},
|
||||
{id: 'descuento', header:{text: 'Descuento', css: 'center'},
|
||||
width: 80, format: webix.i18n.priceFormat, css: 'right', editor: 'text'},
|
||||
width: 80, format: format_currency, css: 'right', editor: 'text'},
|
||||
{id: 'precio_final', hidden: true, header: 'precio_final', width: 80,
|
||||
format: webix.i18n.priceFormat, css: 'right'},
|
||||
{id: "importe", header:{text: 'Importe', css: 'center'}, width: 150,
|
||||
|
|
|
@ -24,7 +24,7 @@ var grid_products_cols = [
|
|||
{ id: "unidad", header: ["Unidad", {content: "selectFilter"}], width: 150,
|
||||
sort:"string" },
|
||||
{ id: "valor_unitario", header: ["Precio", {content: "numberFilter"}],
|
||||
width: 150, sort: 'int', format: webix.i18n.priceFormat, css: "right" },
|
||||
width: 150, sort: 'int', format: format_currency, css: "right" },
|
||||
{ id: 'existencia', header: ['Existencia', {content: 'numberFilter'}],
|
||||
width: 100, sort: 'int', format: webix.i18n.numberFormat,
|
||||
hidden: true, css: 'right' },
|
||||
|
@ -250,4 +250,4 @@ var win_import_products = {
|
|||
$$('cmd_upload_products').attachEvent('onItemClick', cmd_upload_products_click)
|
||||
$$('up_products').attachEvent('onUploadComplete', up_products_upload_complete)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue