Merge branch 'master' of https://github.com/devcode-it/openstamanager
This commit is contained in:
commit
ad5b45a9be
|
@ -55,15 +55,18 @@ for ($i = 1; $i <= 12; ++$i) {
|
|||
|
||||
echo '
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<div class="col-md-3">
|
||||
{[ "type": "date", "label": "'.tr('Data inizio').'", "name": "date_start", "value": "'.$_SESSION['period_start'].'" ]}
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="col-md-3">
|
||||
{[ "type": "date", "label": "'.tr('Data fine').'", "name": "date_end", "value": "'.$_SESSION['period_end'].'" ]}
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="col-md-3">
|
||||
{[ "type": "select", "label": "'.tr('Periodo').'", "name": "periodo", "required": "1", "values": '.json_encode($periodi).', "value": "manuale" ]}
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
{[ "type": "select", "label": "'.tr('Anagrafica').'", "name": "id_anagrafica", "values": "'.$id_anagrafica.'", "ajax-source": "anagrafiche" ]}
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-3">
|
||||
|
@ -97,12 +100,13 @@ echo '
|
|||
function avvia_stampa (){
|
||||
var date_start = $("#date_start").val();
|
||||
var date_end = $("#date_end").val();
|
||||
var id_anagrafica = $("#id_anagrafica").val();
|
||||
var is_pagata = $("#is_pagata").is(":checked");
|
||||
var is_riba = $("#is_riba").is(":checked");
|
||||
var is_cliente = $("#is_cliente").is(":checked");
|
||||
var is_fornitore = $("#is_fornitore").is(":checked");
|
||||
|
||||
window.open("'.$link.'&date_start="+date_start+"&date_end="+date_end+"&is_pagata="+is_pagata+"&is_riba="+is_riba+"&is_cliente="+is_cliente+"&is_fornitore="+is_fornitore, "_blank");
|
||||
|
||||
window.open("'.$link.'&date_start="+date_start+"&date_end="+date_end+"&is_pagata="+is_pagata+"&is_riba="+is_riba+"&is_cliente="+is_cliente+"&is_fornitore="+is_fornitore+"&id_anagrafica="+id_anagrafica, "_blank");
|
||||
}
|
||||
|
||||
$("#is_cliente").change(function() {
|
||||
|
|
|
@ -41,6 +41,11 @@ if (!empty(get('date_end'))) {
|
|||
$date_end = get('date_end');
|
||||
}
|
||||
|
||||
if (get('id_anagrafica') != 'null') {
|
||||
$module_query = str_replace('1=1', '1=1 AND co_scadenziario.idanagrafica="'.get('id_anagrafica').'"', $module_query);
|
||||
$id_anagrafica = get('id_anagrafica');
|
||||
}
|
||||
|
||||
if (get('is_pagata') == 'false') {
|
||||
$module_query = str_replace('1=1', '1=1 AND ABS(`co_scadenziario`.`pagato`) < ABS(`co_scadenziario`.`da_pagare`) ', $module_query);
|
||||
}
|
||||
|
|
|
@ -64,25 +64,6 @@ ORDER BY
|
|||
-- Fix query Ordini cliente
|
||||
UPDATE `zz_views` INNER JOIN `zz_modules` ON `zz_views`.`id_module` = `zz_modules`.`id` SET `zz_views`.`query` = 'IF(emails IS NOT NULL, \'fa fa-envelope text-success\', \'\')' WHERE `zz_modules`.`name` = 'Ordini cliente' AND `zz_views`.`name` = 'icon_Inviata';
|
||||
UPDATE `zz_views` INNER JOIN `zz_modules` ON `zz_views`.`id_module` = `zz_modules`.`id` SET `zz_views`.`name` = 'icon_Inviato' WHERE `zz_modules`.`name` = 'Ordini cliente' AND `zz_views`.`name` = 'icon_Inviata';
|
||||
UPDATE `zz_modules` SET `options` = "
|
||||
SELECT
|
||||
|select|
|
||||
FROM
|
||||
`or_ordini`
|
||||
LEFT JOIN `or_tipiordine` ON `or_ordini`.`idtipoordine` = `or_tipiordine`.`id`
|
||||
LEFT JOIN `an_anagrafiche` ON `or_ordini`.`idanagrafica` = `an_anagrafiche`.`idanagrafica`
|
||||
LEFT JOIN (SELECT `idordine`, SUM(`qta` - `qta_evasa`) AS `qta_da_evadere`, SUM(`subtotale` - `sconto`) AS `totale_imponibile`, SUM(`subtotale` - `sconto` + `iva`) AS `totale` FROM `or_righe_ordini` GROUP BY `idordine`) AS righe ON `or_ordini`.`id` = `righe`.`idordine`
|
||||
LEFT JOIN (SELECT `idordine`, MIN(`data_evasione`) AS `data_evasione` FROM `or_righe_ordini` WHERE (`qta` - `qta_evasa`)>0 GROUP BY `idordine`) AS `righe_da_evadere` ON `righe`.`idordine`=`righe_da_evadere`.`idordine`
|
||||
LEFT JOIN `or_statiordine` ON `or_statiordine`.`id` = `or_ordini`.`idstatoordine`
|
||||
LEFT JOIN (SELECT GROUP_CONCAT(DISTINCT `co_documenti`.`numero_esterno` SEPARATOR ', ') AS `info`, `co_righe_documenti`.`original_document_id` AS `idordine` FROM `co_documenti` INNER JOIN `co_righe_documenti` ON `co_documenti`.`id` = `co_righe_documenti`.`iddocumento` WHERE `original_document_type`='Modules\\\\Ordini\\\\Ordine' GROUP BY `idordine`, `original_document_id`) AS `fattura` ON `fattura`.`idordine` = `or_ordini`.`id`
|
||||
LEFT JOIN (SELECT COUNT(id) as emails, em_emails.id_record FROM em_emails INNER JOIN zz_operations ON zz_operations.id_email = em_emails.id WHERE id_module IN(SELECT id FROM zz_modules WHERE name = 'Ordini cliente') AND `zz_operations`.`op` = 'send-email' GROUP BY em_emails.id_record) AS `email` ON `email`.`id_record` = `or_ordini`.`id`
|
||||
WHERE
|
||||
1=1 |segment(`or_ordini`.`id_segment`)| AND `dir` = 'entrata' |date_period(`or_ordini`.`data`)|
|
||||
HAVING
|
||||
2=2
|
||||
ORDER BY
|
||||
`data` DESC,
|
||||
CAST(`numero_esterno` AS UNSIGNED) DESC" WHERE `name` = 'Ordini cliente';
|
||||
|
||||
-- Fix query Ordini fornitore
|
||||
UPDATE `zz_views` INNER JOIN `zz_modules` ON `zz_views`.`id_module` = `zz_modules`.`id` SET `zz_views`.`query` = 'IF(emails IS NOT NULL, \'fa fa-envelope text-success\', \'\')' WHERE `zz_modules`.`name` = 'Ordini fornitore' AND `zz_views`.`name` = 'icon_Inviata';
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
-- Aggiornamento colonna Riferimenti in Ordini cliente
|
||||
UPDATE `zz_modules` SET `options` = "
|
||||
SELECT
|
||||
|select|
|
||||
FROM
|
||||
`or_ordini`
|
||||
LEFT JOIN `or_tipiordine` ON `or_ordini`.`idtipoordine` = `or_tipiordine`.`id`
|
||||
LEFT JOIN `an_anagrafiche` ON `or_ordini`.`idanagrafica` = `an_anagrafiche`.`idanagrafica`
|
||||
LEFT JOIN (SELECT `idordine`, SUM(`qta` - `qta_evasa`) AS `qta_da_evadere`, SUM(`subtotale` - `sconto`) AS `totale_imponibile`, SUM(`subtotale` - `sconto` + `iva`) AS `totale` FROM `or_righe_ordini` GROUP BY `idordine`) AS righe ON `or_ordini`.`id` = `righe`.`idordine`
|
||||
LEFT JOIN (SELECT `idordine`, MIN(`data_evasione`) AS `data_evasione` FROM `or_righe_ordini` WHERE (`qta` - `qta_evasa`)>0 GROUP BY `idordine`) AS `righe_da_evadere` ON `righe`.`idordine`=`righe_da_evadere`.`idordine`
|
||||
LEFT JOIN `or_statiordine` ON `or_statiordine`.`id` = `or_ordini`.`idstatoordine`
|
||||
LEFT JOIN (SELECT GROUP_CONCAT(DISTINCT 'Fattura ',`co_documenti`.`numero_esterno` SEPARATOR ', ') AS `info`, `co_righe_documenti`.`original_document_id` AS `idordine` FROM `co_documenti` INNER JOIN `co_righe_documenti` ON `co_documenti`.`id` = `co_righe_documenti`.`iddocumento` WHERE `original_document_type`='Modules\\\\Ordini\\\\Ordine' GROUP BY `idordine`, `original_document_id`) AS `fattura` ON `fattura`.`idordine` = `or_ordini`.`id`
|
||||
LEFT JOIN (SELECT GROUP_CONCAT(DISTINCT 'DDT ', `dt_ddt`.`id` SEPARATOR ', ') AS `info`, `dt_righe_ddt`.`original_document_id` AS `idddt` FROM `dt_ddt` INNER JOIN `dt_righe_ddt` ON `dt_ddt`.`id`=`dt_righe_ddt`.`idddt` WHERE `original_document_type`='Modules\\\\Ordini\\\\Ordine' GROUP BY `idddt`, `original_document_id`) AS `ddt` ON `ddt`.`idddt`=`or_ordini`.`id`
|
||||
LEFT JOIN (SELECT COUNT(id) as emails, em_emails.id_record FROM em_emails INNER JOIN zz_operations ON zz_operations.id_email = em_emails.id WHERE id_module IN(SELECT id FROM zz_modules WHERE name = 'Ordini cliente') AND `zz_operations`.`op` = 'send-email' GROUP BY em_emails.id_record) AS `email` ON `email`.`id_record` = `or_ordini`.`id`
|
||||
WHERE
|
||||
1=1 |segment(`or_ordini`.`id_segment`)| AND `dir` = 'entrata' |date_period(`or_ordini`.`data`)|
|
||||
HAVING
|
||||
2=2
|
||||
ORDER BY
|
||||
`data` DESC,
|
||||
CAST(`numero_esterno` AS UNSIGNED) DESC" WHERE `name` = 'Ordini cliente';
|
||||
|
||||
UPDATE `zz_views` INNER JOIN `zz_modules` ON `zz_views`.`id_module` = `zz_modules`.`id` SET `zz_views`.`query` = 'CONCAT(IF(fattura.info != "", fattura.info,""), IF(ddt.info != "", ddt.info,""))' WHERE `zz_modules`.`name` = 'Ordini cliente' AND `zz_views`.`name` = 'Rif. fattura';
|
||||
UPDATE `zz_views` INNER JOIN `zz_modules` ON `zz_views`.`id_module` = `zz_modules`.`id` SET `zz_views`.`name` = 'Riferimenti' WHERE `zz_modules`.`name` = 'Ordini cliente' AND `zz_views`.`query` = 'CONCAT(IF(fattura.info != "", fattura.info,""), IF(ddt.info != "", ddt.info,""))';
|
Loading…
Reference in New Issue