|
@@ -57,14 +57,10 @@ function report_sales (reporting){
|
|
|
return self.fetchAttachment();
|
|
|
}).then(function(attachment){
|
|
|
self.attachment=attachment;
|
|
|
- return self.fecthComanyCurrency();
|
|
|
+ return self.fecthCompany();
|
|
|
}).then(function(resCompany){
|
|
|
self.resCompany = resCompany;
|
|
|
- self.inicializarBuscadorsup();
|
|
|
return self.fect_generar(self.invoice);
|
|
|
- }).then(function(currency){
|
|
|
- self.currency = currency;
|
|
|
- // return self.fect_cabecera(self.resCompany, self.invoice);
|
|
|
});
|
|
|
},
|
|
|
// Buscar Diario
|
|
@@ -102,19 +98,19 @@ function report_sales (reporting){
|
|
|
});
|
|
|
return defer;
|
|
|
},
|
|
|
- // company_curency
|
|
|
- fecthComanyCurrency: function(){
|
|
|
+ // company
|
|
|
+ fecthCompany: function(){
|
|
|
var self = this;
|
|
|
var defer = $.Deferred();
|
|
|
- var currency = new instance.web.Model('res.company');
|
|
|
+ var company = new instance.web.Model('res.company');
|
|
|
var field=['id', 'currency_id','exportador','agent_ruc','legal_agent','company_ruc','name','juridico'];
|
|
|
var domain=[['id','=',1]];
|
|
|
- currency.query(field).filter(domain).all().then(function(results){
|
|
|
+ company.query(field).filter(domain).all().then(function(results){
|
|
|
defer.resolve(results);
|
|
|
});
|
|
|
return defer;
|
|
|
},
|
|
|
- // Partner (Proveeedor)
|
|
|
+ // Clientes
|
|
|
fetchCustomer: function() {
|
|
|
var self = this;
|
|
|
var defer = $.Deferred();
|
|
@@ -158,32 +154,6 @@ function report_sales (reporting){
|
|
|
}
|
|
|
return valor;
|
|
|
},
|
|
|
- // Buscador
|
|
|
- inicializarBuscadorsup: function () {
|
|
|
- var self = this;
|
|
|
- var results = self.customer;
|
|
|
- results = _.map(results, function (item) {
|
|
|
- return {
|
|
|
- label: item.id + '-'+ item.name + ' ' + self.valorNull(item.ruc),
|
|
|
- value: item.id + '-'+ item.name + ' ' + self.valorNull(item.ruc)
|
|
|
- }
|
|
|
- });
|
|
|
- self.$('#customer').autocomplete({
|
|
|
- source: results,
|
|
|
- minLength:0,
|
|
|
- search: function(event, ui) {
|
|
|
- if (!(self.$('#customer').val())){
|
|
|
- self.factSearch();
|
|
|
- }
|
|
|
- },
|
|
|
- close: function( event, ui ) {
|
|
|
- self.factSearch();
|
|
|
- },
|
|
|
- select: function(event, ui) {
|
|
|
- self.factSearch();
|
|
|
- }
|
|
|
- });
|
|
|
- },
|
|
|
// Obtener el cliente
|
|
|
getCustomer : function(partner_id){
|
|
|
var self = this;
|
|
@@ -370,10 +340,10 @@ function report_sales (reporting){
|
|
|
datos.push(tipo);
|
|
|
datos.push('\t');
|
|
|
// Codigo Obligacion
|
|
|
- datos.push(911);
|
|
|
+ datos.push(921);
|
|
|
datos.push('\t');
|
|
|
// Codigo Formulario
|
|
|
- datos.push(211);
|
|
|
+ datos.push(221);
|
|
|
datos.push('\t');
|
|
|
// Ruc agente de informacion
|
|
|
datos.push(company_ruc[0]);
|
|
@@ -481,6 +451,7 @@ function report_sales (reporting){
|
|
|
datos[22] = cantidad;
|
|
|
datos.splice(24,0);
|
|
|
datos[24] = ingreso;
|
|
|
+ // console.log(datos);
|
|
|
self.newCabecera = new Blob(datos, {type: 'text/plain'});
|
|
|
},
|
|
|
|