Can select global options for public invoice
This commit is contained in:
commit
8b0f9fbc64
|
@ -5700,10 +5700,10 @@ class Facturas(BaseModel):
|
||||||
|
|
||||||
data_global = {}
|
data_global = {}
|
||||||
if is_global:
|
if is_global:
|
||||||
now = utils.now()
|
values = invoice.periodicidad.split('|')
|
||||||
data_global['Periodicidad'] = invoice.periodicidad
|
data_global['Periodicidad'] = values[0]
|
||||||
data_global['Meses'] = now.strftime('%m')
|
data_global['Meses'] = values[1]
|
||||||
data_global['Año'] = now.strftime('%Y')
|
data_global['Año'] = values[2]
|
||||||
|
|
||||||
frm_vu = FORMAT
|
frm_vu = FORMAT
|
||||||
if decimales_precios:
|
if decimales_precios:
|
||||||
|
@ -5793,15 +5793,6 @@ class Facturas(BaseModel):
|
||||||
if not row.producto is None:
|
if not row.producto is None:
|
||||||
object_tax = row.producto.objeto_impuesto
|
object_tax = row.producto.objeto_impuesto
|
||||||
|
|
||||||
# cfdi4
|
|
||||||
# ~ if not is_global:
|
|
||||||
# ~ concepto['ObjetoImp'] = row.producto.objeto_impuesto
|
|
||||||
# ~ else:
|
|
||||||
# ~ if taxes:
|
|
||||||
# ~ concepto['ObjetoImp'] = '02'
|
|
||||||
# ~ else:
|
|
||||||
# ~ concepto['ObjetoImp'] = '01'
|
|
||||||
|
|
||||||
if is_global:
|
if is_global:
|
||||||
key_sat = row.clave_sat
|
key_sat = row.clave_sat
|
||||||
key = row.clave
|
key = row.clave
|
||||||
|
@ -5846,20 +5837,24 @@ class Facturas(BaseModel):
|
||||||
|
|
||||||
if invoice.tipo_comprobante != 'T':
|
if invoice.tipo_comprobante != 'T':
|
||||||
if is_global:
|
if is_global:
|
||||||
ticket = (Tickets
|
ticket = None
|
||||||
.get(fn.Concat(Tickets.serie, Tickets.folio)==row.clave)
|
try:
|
||||||
)
|
ticket = (Tickets
|
||||||
product_taxes = (TicketsImpuestos
|
.get(fn.Concat(Tickets.serie, Tickets.folio)==row.clave)
|
||||||
.select()
|
)
|
||||||
.where(TicketsImpuestos.ticket==ticket)
|
product_taxes = (TicketsImpuestos
|
||||||
)
|
.select()
|
||||||
|
.where(TicketsImpuestos.ticket==ticket)
|
||||||
|
)
|
||||||
|
except Tickets.DoesNotExist:
|
||||||
|
product_taxes = row.producto.impuestos
|
||||||
else:
|
else:
|
||||||
product_taxes = row.producto.impuestos
|
product_taxes = row.producto.impuestos
|
||||||
|
|
||||||
if object_tax == '02':
|
if object_tax == '02':
|
||||||
for impuesto in product_taxes:
|
for impuesto in product_taxes:
|
||||||
base = float(row.importe - row.descuento)
|
base = float(row.importe - row.descuento)
|
||||||
if is_global:
|
if is_global and not ticket is None:
|
||||||
base = float(impuesto.base)
|
base = float(impuesto.base)
|
||||||
impuesto = impuesto.impuesto
|
impuesto = impuesto.impuesto
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@ var anticipo = false
|
||||||
var donativo = false
|
var donativo = false
|
||||||
var cfg_invoice = new Object()
|
var cfg_invoice = new Object()
|
||||||
var values_comercioe = null
|
var values_comercioe = null
|
||||||
|
var values_global = ''
|
||||||
|
|
||||||
|
|
||||||
function init_config_invoices(){
|
function init_config_invoices(){
|
||||||
|
@ -33,6 +34,7 @@ function init_config_invoices(){
|
||||||
g.showColumn('total')
|
g.showColumn('total')
|
||||||
g.showColumn('currency')
|
g.showColumn('currency')
|
||||||
}
|
}
|
||||||
|
show('cmd_show_global_information', false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -96,6 +98,7 @@ var invoices_controllers = {
|
||||||
$$('cmd_carta_copy_from_invoice').attachEvent('onItemClick', cmd_carta_copy_from_invoice_click)
|
$$('cmd_carta_copy_from_invoice').attachEvent('onItemClick', cmd_carta_copy_from_invoice_click)
|
||||||
$$('cmd_carta_import_json').attachEvent('onItemClick', cmd_carta_import_json_click)
|
$$('cmd_carta_import_json').attachEvent('onItemClick', cmd_carta_import_json_click)
|
||||||
$$('cmd_import_json_comercioe').attachEvent('onItemClick', cmd_import_json_comercioe_click)
|
$$('cmd_import_json_comercioe').attachEvent('onItemClick', cmd_import_json_comercioe_click)
|
||||||
|
$$('cmd_show_global_information').attachEvent('onItemClick', cmd_show_global_information_click)
|
||||||
|
|
||||||
webix.extend($$('grid_invoices'), webix.ProgressBar)
|
webix.extend($$('grid_invoices'), webix.ProgressBar)
|
||||||
|
|
||||||
|
@ -256,6 +259,8 @@ function default_config(){
|
||||||
show('txt_total_cant', values.cfdi_show_total_cant)
|
show('txt_total_cant', values.cfdi_show_total_cant)
|
||||||
show('date_invoice', values.cfdi_change_date_invoice)
|
show('date_invoice', values.cfdi_change_date_invoice)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
values_global = ''
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -298,6 +303,7 @@ function cmd_new_invoice_click(){
|
||||||
lst.getList().clearAll()
|
lst.getList().clearAll()
|
||||||
|
|
||||||
$$('date_invoice').setValue(new Date())
|
$$('date_invoice').setValue(new Date())
|
||||||
|
show('cmd_show_global_information', false)
|
||||||
|
|
||||||
form.focus('search_client_name')
|
form.focus('search_client_name')
|
||||||
}
|
}
|
||||||
|
@ -537,6 +543,14 @@ function validate_invoice(values){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($$('cmd_show_global_information').isVisible()){
|
||||||
|
if(values_global==''){
|
||||||
|
msg = 'Captura los datos de la Factura Global'
|
||||||
|
msg_error(msg)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -724,6 +738,8 @@ function guardar_y_timbrar(values){
|
||||||
data['folio_custom'] = $$('txt_folio_custom').getValue()
|
data['folio_custom'] = $$('txt_folio_custom').getValue()
|
||||||
data['divisas'] = $$('opt_divisas').getValue()
|
data['divisas'] = $$('opt_divisas').getValue()
|
||||||
data['leyendas_fiscales'] = $$('grid_leyendas_fiscales').getSelectedId(true, true)
|
data['leyendas_fiscales'] = $$('grid_leyendas_fiscales').getSelectedId(true, true)
|
||||||
|
data['periodicidad'] = values_global
|
||||||
|
|
||||||
$$('grid_leyendas_fiscales').unselectAll()
|
$$('grid_leyendas_fiscales').unselectAll()
|
||||||
|
|
||||||
var usar_ine = $$('chk_cfdi_usar_ine').getValue()
|
var usar_ine = $$('chk_cfdi_usar_ine').getValue()
|
||||||
|
@ -817,6 +833,7 @@ function guardar_y_timbrar(values){
|
||||||
}
|
}
|
||||||
|
|
||||||
values_comercioe = null
|
values_comercioe = null
|
||||||
|
values_global = ''
|
||||||
$$('chk_cfdi_usar_comercioe').setValue(false)
|
$$('chk_cfdi_usar_comercioe').setValue(false)
|
||||||
|
|
||||||
table_relaciones.clear()
|
table_relaciones.clear()
|
||||||
|
@ -825,6 +842,7 @@ function guardar_y_timbrar(values){
|
||||||
$$('chk_cfdi_anticipo').setValue(0)
|
$$('chk_cfdi_anticipo').setValue(0)
|
||||||
$$('chk_cfdi_donativo').setValue(0)
|
$$('chk_cfdi_donativo').setValue(0)
|
||||||
$$('chk_cfdi_usar_ine').setValue(0)
|
$$('chk_cfdi_usar_ine').setValue(0)
|
||||||
|
show('cmd_show_global_information', false)
|
||||||
|
|
||||||
$$('form_invoice').setValues({id_partner: 0, lbl_partner: 'Ninguno', notas:''})
|
$$('form_invoice').setValues({id_partner: 0, lbl_partner: 'Ninguno', notas:''})
|
||||||
$$('multi_invoices').setValue('invoices_home')
|
$$('multi_invoices').setValue('invoices_home')
|
||||||
|
@ -893,6 +911,10 @@ function cmd_timbrar_click(id, e, node){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($$('cmd_show_global_information').isVisible()){
|
||||||
|
msg += 'Es una Factura Global<BR><BR>'
|
||||||
|
}
|
||||||
|
|
||||||
msg += '¿Estás seguro de timbrar esta factura?<BR><BR>'
|
msg += '¿Estás seguro de timbrar esta factura?<BR><BR>'
|
||||||
|
|
||||||
webix.confirm({
|
webix.confirm({
|
||||||
|
@ -965,6 +987,12 @@ function set_client(row){
|
||||||
}
|
}
|
||||||
lst.setValue(lst.getPopup().getList().getFirstId())
|
lst.setValue(lst.getPopup().getList().getFirstId())
|
||||||
|
|
||||||
|
if(row.nombre == PUBLICO && row.rfc == RFC_PUBLICO){
|
||||||
|
show('cmd_show_global_information', true)
|
||||||
|
}else{
|
||||||
|
show('cmd_show_global_information', false)
|
||||||
|
}
|
||||||
|
|
||||||
form.focus('search_product_id')
|
form.focus('search_product_id')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2923,3 +2951,20 @@ function up_invoice_json_comercioe_on_after_file_add(obj){
|
||||||
}
|
}
|
||||||
$$('win_import_json_comercioe').close()
|
$$('win_import_json_comercioe').close()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function cmd_show_global_information_click(){
|
||||||
|
win_global_information.init()
|
||||||
|
$$('win_global_information').show()
|
||||||
|
}
|
||||||
|
|
||||||
|
function cmd_save_global_information_click(){
|
||||||
|
values_global = $$('lst_global_periodicidad').getValue() + "|"
|
||||||
|
values_global += $$('lst_global_months').getValue() + "|"
|
||||||
|
values_global += $$('lst_global_year').getValue()
|
||||||
|
$$('win_global_information').close()
|
||||||
|
}
|
||||||
|
|
||||||
|
function cmd_win_global_close_click(){
|
||||||
|
$$('win_global_information').close()
|
||||||
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
//~ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
//~ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
var PUBLICO = "Público en general";
|
var PUBLICO = "PUBLICO EN GENERAL";
|
||||||
var RFC_PUBLICO = "XAXX010101000";
|
var RFC_PUBLICO = "XAXX010101000";
|
||||||
var RFC_EXTRANJERO = "XEXX010101000";
|
var RFC_EXTRANJERO = "XEXX010101000";
|
||||||
var PAIS = "México";
|
var PAIS = "México";
|
||||||
|
@ -627,3 +627,33 @@ function grid_parse(grid_name, values){
|
||||||
function activate_tab(parent, name){
|
function activate_tab(parent, name){
|
||||||
$$(parent).getTabbar().setValue(name)
|
$$(parent).getTabbar().setValue(name)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var opt_global_periodicidad = [
|
||||||
|
{id: '01', value: '[01] Diario'},
|
||||||
|
{id: '02', value: '[02] Semanal'},
|
||||||
|
{id: '03', value: '[03] Quincenal'},
|
||||||
|
{id: '04', value: '[04] Mensual'},
|
||||||
|
{id: '05', value: '[05] Bimestral'},
|
||||||
|
]
|
||||||
|
|
||||||
|
var opt_global_months = [
|
||||||
|
{id: '01', value: '[01] Enero'},
|
||||||
|
{id: '02', value: '[02] Febrero'},
|
||||||
|
{id: '03', value: '[03] Marzo'},
|
||||||
|
{id: '04', value: '[04] Abril'},
|
||||||
|
{id: '05', value: '[05] Mayo'},
|
||||||
|
{id: '06', value: '[06] Junio'},
|
||||||
|
{id: '07', value: '[07] Julio'},
|
||||||
|
{id: '08', value: '[08] Agosto'},
|
||||||
|
{id: '09', value: '[09] Septiembre'},
|
||||||
|
{id: '10', value: '[10] Octubre'},
|
||||||
|
{id: '11', value: '[11] Noviembre'},
|
||||||
|
{id: '12', value: '[12] Diciembre'},
|
||||||
|
{id: '13', value: '[13] Enero-Febrero'},
|
||||||
|
{id: '14', value: '[14] Marzo-Abril'},
|
||||||
|
{id: '15', value: '[15] Mayo-Junio'},
|
||||||
|
{id: '16', value: '[16] Julio-Agosto'},
|
||||||
|
{id: '17', value: '[17] Septiembre-Octubre'},
|
||||||
|
{id: '18', value: '[18] Noviembre-Diciembre'},
|
||||||
|
]
|
||||||
|
|
|
@ -224,6 +224,8 @@ var toolbar_invoices_generate = {view: 'toolbar', elements: [{},
|
||||||
labelWidth: 0, width: 100, hidden: true},
|
labelWidth: 0, width: 100, hidden: true},
|
||||||
{view: 'checkbox', id: 'chk_cfdi_donativo', labelRight: 'Es Donativo',
|
{view: 'checkbox', id: 'chk_cfdi_donativo', labelRight: 'Es Donativo',
|
||||||
labelWidth: 0, width: 100, hidden: true},
|
labelWidth: 0, width: 100, hidden: true},
|
||||||
|
{view: 'button', id: 'cmd_show_global_information', label: 'Global',
|
||||||
|
type: 'iconButton', autowidth: true, hidden: false, icon: 'file-code-o'},
|
||||||
{}]}
|
{}]}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1428,3 +1430,44 @@ var win_import_json_comercioe = {
|
||||||
$$('up_invoice_json').attachEvent('onAfterFileAdd', up_invoice_json_comercioe_on_after_file_add)
|
$$('up_invoice_json').attachEvent('onAfterFileAdd', up_invoice_json_comercioe_on_after_file_add)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var body_global_information = {rows: [{minHeight: 5},
|
||||||
|
{view: 'richselect', id: 'lst_global_periodicidad', label: 'Periodicidad:', options: opt_global_periodicidad, value: '01'},
|
||||||
|
{view: 'richselect', id: 'lst_global_months', label: 'Mes:', options: opt_global_months, value: '01'},
|
||||||
|
{view: 'richselect', id: 'lst_global_year', label: 'Año:', options: []},
|
||||||
|
{view: 'label', label: '¿Guardar estos datos?', width: 300, align: 'center'},
|
||||||
|
{cols: [{},
|
||||||
|
{view: 'button', id: 'cmd_save_global_information', width: 100, label: 'Si Guardar'},
|
||||||
|
{maxWidth: 25},
|
||||||
|
{view: 'button', id: 'cmd_win_global_close', width: 100, label: 'No, Cerrar'},
|
||||||
|
{}
|
||||||
|
]},
|
||||||
|
{minHeight: 10},
|
||||||
|
]}
|
||||||
|
|
||||||
|
|
||||||
|
var win_global_information = {
|
||||||
|
init: function(){
|
||||||
|
webix.ui({
|
||||||
|
view: 'window',
|
||||||
|
id: 'win_global_information',
|
||||||
|
modal: true,
|
||||||
|
width: 400,
|
||||||
|
position: 'center',
|
||||||
|
head: 'Información Global',
|
||||||
|
body: body_global_information,
|
||||||
|
})
|
||||||
|
|
||||||
|
var current_date = new Date()
|
||||||
|
var current_month = (current_date.getMonth() + 1).toString().padStart(2, '0')
|
||||||
|
$$('lst_global_months').setValue(current_month)
|
||||||
|
|
||||||
|
var current_year = current_date.getFullYear()
|
||||||
|
$$('lst_global_year').getList().parse([{id: current_year, value: current_year}])
|
||||||
|
$$('lst_global_year').setValue(current_year)
|
||||||
|
|
||||||
|
$$('cmd_save_global_information').attachEvent('onItemClick', cmd_save_global_information_click)
|
||||||
|
$$('cmd_win_global_close').attachEvent('onItemClick', cmd_win_global_close_click)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue