finish facture group details
This commit is contained in:
parent
a5188b7ebc
commit
7eb0a45a66
@ -65,6 +65,7 @@ return [
|
||||
['name' => 'page#getFactures', 'url' => '/getFactures', 'verb' => 'PROPFIND'],
|
||||
['name' => 'page#getFacturesWithProduits', 'url' => '/getFacturesWithProduits', 'verb' => 'PROPFIND'],
|
||||
['name' => 'page#factureshow', 'url' => '/facture/{numfacture}/show', 'verb' => 'GET'],
|
||||
['name' => 'page#factureGroupDetails', 'url' => '/facture/{numfacture}/groupDetails', 'verb' => 'GET'],
|
||||
['name' => 'page#apercustoutesfactures', 'url' => '/factures/apercus', 'verb' => 'GET'],
|
||||
['name' => 'page#apercustousdevis', 'url' => '/devis/apercus', 'verb' => 'GET'],
|
||||
['name' => 'page#insertFacture', 'url' => '/facture/insert', 'verb' => 'POST'],
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
2
gestion/js/factureGroupDetails.app.js
Normal file
2
gestion/js/factureGroupDetails.app.js
Normal file
File diff suppressed because one or more lines are too long
46
gestion/js/factureGroupDetails.app.js.LICENSE.txt
Normal file
46
gestion/js/factureGroupDetails.app.js.LICENSE.txt
Normal file
@ -0,0 +1,46 @@
|
||||
/*!
|
||||
* Sizzle CSS Selector Engine v2.3.9
|
||||
* https://sizzlejs.com/
|
||||
*
|
||||
* Copyright JS Foundation and other contributors
|
||||
* Released under the MIT license
|
||||
* https://js.foundation/
|
||||
*
|
||||
* Date: 2022-12-19
|
||||
*/
|
||||
|
||||
/*!
|
||||
* Toastify js 1.12.0
|
||||
* https://github.com/apvarun/toastify-js
|
||||
* @license MIT licensed
|
||||
*
|
||||
* Copyright (C) 2018 Varun A P
|
||||
*/
|
||||
|
||||
/*!
|
||||
* escape-html
|
||||
* Copyright(c) 2012-2013 TJ Holowaychuk
|
||||
* Copyright(c) 2015 Andreas Lubbe
|
||||
* Copyright(c) 2015 Tiancheng "Timothy" Gu
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/*!
|
||||
* jQuery JavaScript Library v3.6.3
|
||||
* https://jquery.com/
|
||||
*
|
||||
* Includes Sizzle.js
|
||||
* https://sizzlejs.com/
|
||||
*
|
||||
* Copyright OpenJS Foundation and other contributors
|
||||
* Released under the MIT license
|
||||
* https://jquery.org/license
|
||||
*
|
||||
* Date: 2022-12-20T21:28Z
|
||||
*/
|
||||
|
||||
/*! @license DOMPurify 2.4.4 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/2.4.4/LICENSE */
|
||||
|
||||
/*! DataTables 1.13.2
|
||||
* ©2008-2023 SpryMedia Ltd - datatables.net/license
|
||||
*/
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -3,6 +3,7 @@ namespace OCA\Gestion\Controller;
|
||||
|
||||
use Exception;
|
||||
use OCA\Gestion\Constants\BddConstant;
|
||||
use OCA\Gestion\Constants\DevisMentionConstant;
|
||||
use OCA\Gestion\Constants\FactureTypeConstant;
|
||||
use OCA\Gestion\Service\InvoicePdfHandler;
|
||||
defined("TAB1") or define("TAB1", "\t");
|
||||
@ -342,7 +343,13 @@ class PageController extends Controller {
|
||||
* @NoCSRFRequired
|
||||
*/
|
||||
public function apercustousdevis() {
|
||||
$devis = json_decode($this->myDb->getDevis($this->idNextcloud));
|
||||
$devisMentionsFilter = [
|
||||
DevisMentionConstant::FACTURED,
|
||||
DevisMentionConstant::FACTURED_FORMATTED,
|
||||
DevisMentionConstant::MENTION,
|
||||
DevisMentionConstant::NEW
|
||||
];
|
||||
$devis = json_decode($this->myDb->getDevis($this->idNextcloud,$devisMentionsFilter));
|
||||
foreach ($devis as $key => $d) {
|
||||
$d->dproduits = [];
|
||||
$produits = json_decode($this->myDb->getListProduit($d->id, $this->idNextcloud));
|
||||
@ -2965,10 +2972,10 @@ class PageController extends Controller {
|
||||
*/
|
||||
public function factureGroupDetails($numfacture){
|
||||
$this->denyIfNotAdmin();
|
||||
$facture = $this->myDb->getOneFacture($numfacture,$this->idNextcloud);
|
||||
return new TemplateResponse('gestion', 'factureshow', array('groups' => $this->groups, 'user' => $this->user, 'path' => $this->idNextcloud,
|
||||
$facture = $this->myDb->getFactureGroupByFactureIdWithDetails($numfacture);
|
||||
return new TemplateResponse('gestion', 'factureGroupDetails', array('groups' => $this->groups, 'user' => $this->user, 'path' => $this->idNextcloud,
|
||||
'configuration'=> $this->getConfiguration(),
|
||||
'facture'=>json_decode($facture),
|
||||
'facture'=>json_decode(json_encode($facture)),
|
||||
'url' => $this->getNavigationLink(),
|
||||
'logo' => $this->getLogo()
|
||||
));
|
||||
|
||||
@ -51,7 +51,8 @@ class Bdd {
|
||||
"product_brand","product_reference",
|
||||
"fk_user_uuid",
|
||||
"phone_number","address",'postal_code','city','email','siret_number','tva_intracommu',
|
||||
'order_number','case_number','fk_template_type_key');
|
||||
'order_number','case_number','fk_template_type_key',
|
||||
'facture_case_number','facture_order_number');
|
||||
$this->whiteTable = array(
|
||||
"client", "lieu", "trajet", "devis", "produit_devis", "facture", "produit", "configuration", "ligne_trajet", "thanato", "article", "defunt", "article_devis", "bibliotheque", "bijou_defunt", "obs_defunt", "hypo_defunt",
|
||||
"client_group_discount","client_group",
|
||||
@ -352,6 +353,9 @@ class Bdd {
|
||||
.$this->tableprefix."facture.fk_facture_status_key, ".$this->tableprefix."facture.fk_facture_payment_type_id, ".$this->tableprefix."facture.payment_date, "
|
||||
.$this->tableprefix."facture_payment_type.facture_payment_type_label, "
|
||||
.$this->tableprefix."facture_status.facture_status_label, "
|
||||
.$this->tableprefix."facture.facture_type, "
|
||||
.$this->tableprefix."facture.fk_client_id as facture_client_id, "
|
||||
.$this->tableprefix."facture.fk_client_group_facturation_id as facture_client_group_facturation_id, "
|
||||
.$this->tableprefix."devis.num as dnum, ".$this->tableprefix."devis.comment as dcomment, date_paiement, type_paiement, id_devis, entreprise, "
|
||||
.$this->tableprefix."facture.version, status_paiement,"
|
||||
.$this->tableprefix."client.nom, ".$this->tableprefix."client.prenom, "
|
||||
@ -2706,7 +2710,7 @@ class Bdd {
|
||||
client.prenom as client_prenom,
|
||||
client.entreprise as client_entreprise,
|
||||
client.legal_one as client_legal_one,
|
||||
client.addresse as client_address,
|
||||
client.adresse as client_address,
|
||||
client.mail as client_mail,
|
||||
client.fk_client_group_id as fk_client_group_id
|
||||
FROM ".$this->tableprefix."client as client
|
||||
@ -2803,25 +2807,29 @@ class Bdd {
|
||||
$tvaValue = $configuration->tva_default;
|
||||
$factureData = $this->getFactureByFactureId($factureId);
|
||||
$isFactureForSingleClient = $factureData['fk_client_id'] != null && $factureData['fk_client_id'] != 0;
|
||||
$devisMentionFilters = [
|
||||
DevisMentionConstant::FACTURED_FORMATTED,
|
||||
DevisMentionConstant::FACTURED
|
||||
];
|
||||
if($isFactureForSingleClient){
|
||||
$factureDevisList = $this->getDevisDataByClientIdAndMonthYear(
|
||||
$factureData['fk_client_id'],
|
||||
$factureData['month'],
|
||||
$factureData['year']);
|
||||
$factureData['year'],$devisMentionFilters
|
||||
);
|
||||
}
|
||||
else{
|
||||
$factureDevisList = $this->getDevisDataByClientGroupFacturationIdAndMonthYear(
|
||||
$factureData['fk_client_group_facturation_id'],
|
||||
$factureData['month'],
|
||||
$factureData['year']);
|
||||
$factureData['year'],$devisMentionFilters
|
||||
);
|
||||
}
|
||||
$factureIncrement = 0;
|
||||
$productsCount = 0;
|
||||
$totalHt = 0;
|
||||
$totalTtc = 0;
|
||||
$totalTva = 0;
|
||||
$caseNumber = "";
|
||||
$orderNumber = "";
|
||||
$templateType = ClientTemplateTypeConstant::PRIVEES;
|
||||
foreach($factureDevisList as &$devis){
|
||||
if($factureIncrement == 0){
|
||||
@ -2842,8 +2850,6 @@ class Bdd {
|
||||
$templateType = $devis['fk_template_type_key'] ?? ClientTemplateTypeConstant::PRIVEES;
|
||||
}
|
||||
}
|
||||
$caseNumber = empty($devis["case_number"]) ? $caseNumber : $devis["case_number"];
|
||||
$orderNumber = empty($devis["order_number"]) ? $orderNumber : $devis["order_number"];
|
||||
$products = $this->getDevisProduits($devis["devis_id"]);
|
||||
foreach($products as $product){
|
||||
$valueHt = $product['produit_price'] * $product['quantite'];
|
||||
@ -2869,8 +2875,6 @@ class Bdd {
|
||||
$factureData["configuration_adresse_city"] = $configurationAdresses["city"];
|
||||
$factureData["productsCount"] = $productsCount;
|
||||
$factureData["totalPrices"] = $totaPricesArray;
|
||||
$factureData["case_number"] = $caseNumber;
|
||||
$factureData["order_number"] = $orderNumber;
|
||||
$factureData["template_type_key"] = $templateType;
|
||||
return $factureData;
|
||||
}
|
||||
@ -4166,7 +4170,7 @@ class Bdd {
|
||||
return FactureTypeConstant::TYPE_SINGLE;
|
||||
}
|
||||
|
||||
public function getDevisIdsByClientGroupFacturationIdAndMonthYear($clientGroupFacturationId,$month,$year){
|
||||
public function getDevisIdsByClientGroupFacturationIdAndMonthYear($clientGroupFacturationId,$month,$year,$mentionFilters = []){
|
||||
$sql = "SELECT devis.id
|
||||
FROM ".$this->tableprefix."devis as devis
|
||||
LEFT JOIN ".$this->tableprefix."client as client on devis.id_client = client.id
|
||||
@ -4176,27 +4180,39 @@ class Bdd {
|
||||
MONTH(devis.date) = ?
|
||||
";
|
||||
|
||||
$result = $this->execSQLNoJsonReturn($sql,[$clientGroupFacturationId,$year,$month]);
|
||||
$conditions = [$clientGroupFacturationId,$year,$month];
|
||||
if(!empty($mentionFilters)){
|
||||
$mentionsFilterPlaceholders = implode(',', array_fill(0, count($mentionFilters), '?'));
|
||||
$sql .= " AND ". $this->tableprefix."devis.mentions IN ($mentionsFilterPlaceholders)";
|
||||
$conditions = array_merge($conditions, $mentionFilters);
|
||||
}
|
||||
$sql.= ";";
|
||||
$result = $this->execSQLNoJsonReturn($sql,$conditions);
|
||||
|
||||
$devisIds = [];
|
||||
foreach($result as $currentResult){
|
||||
$devisIds[] = $currentResult['id'];
|
||||
}
|
||||
return $devisIds;
|
||||
|
||||
}
|
||||
|
||||
public function getDevisIdsByClientIdAndMonthYear($clientId,$month,$year){
|
||||
public function getDevisIdsByClientIdAndMonthYear($clientId,$month,$year,$mentionFilters = []){
|
||||
$sql = "SELECT devis.id
|
||||
FROM ".$this->tableprefix."devis as devis
|
||||
LEFT JOIN ".$this->tableprefix."client as client on devis.id_client = client.id
|
||||
WHERE
|
||||
client.id = ? AND
|
||||
YEAR(devis.date) = ? AND
|
||||
MONTH(devis.date) = ?
|
||||
";
|
||||
MONTH(devis.date) = ?";
|
||||
|
||||
$result = $this->execSQLNoJsonReturn($sql,[$clientId,$year,$month]);
|
||||
$conditions = [$clientId,$year,$month];
|
||||
if(!empty($mentionFilters)){
|
||||
$mentionsFilterPlaceholders = implode(',', array_fill(0, count($mentionFilters), '?'));
|
||||
$sql .= " AND devis.mentions IN ($mentionsFilterPlaceholders)";
|
||||
$conditions = array_merge($conditions, $mentionFilters);
|
||||
}
|
||||
$sql.= ";";
|
||||
$result = $this->execSQLNoJsonReturn($sql,$conditions);
|
||||
|
||||
$devisIds = [];
|
||||
foreach($result as $currentResult){
|
||||
@ -4266,7 +4282,7 @@ class Bdd {
|
||||
$this->execSQLNoData($sql,$conditions);
|
||||
}
|
||||
|
||||
private function getDevisDataByClientGroupFacturationIdAndMonthYear($clientGroupFacturationId,$month,$year){
|
||||
private function getDevisDataByClientGroupFacturationIdAndMonthYear($clientGroupFacturationId,$month,$year,$mentionFilters = []){
|
||||
$sql = "SELECT
|
||||
devis.id as devis_id,
|
||||
devis.date as devis_date,
|
||||
@ -4274,6 +4290,7 @@ class Bdd {
|
||||
devis.comment as devis_comment,
|
||||
devis.order_number as order_number,
|
||||
devis.case_number as case_number,
|
||||
devis.devis_full_number as devis_full_number,
|
||||
client.nom as client_nom,
|
||||
client.entreprise as client_entreprise,
|
||||
client.adresse as client_adresse,
|
||||
@ -4304,19 +4321,21 @@ class Bdd {
|
||||
WHERE
|
||||
client.fk_client_group_facturation_id = ? AND
|
||||
YEAR(devis.date) = ? AND
|
||||
MONTH(devis.date) = ?
|
||||
ORDER BY devis.date ASC;";
|
||||
MONTH(devis.date) = ?";
|
||||
|
||||
$devisList = $this->execSQLNoJsonReturn($sql,[
|
||||
$clientGroupFacturationId,
|
||||
$year,
|
||||
$month
|
||||
]);
|
||||
$conditions = [$clientGroupFacturationId,$year,$month];
|
||||
if(!empty($mentionFilters)){
|
||||
$mentionsFilterPlaceholders = implode(',', array_fill(0, count($mentionFilters), '?'));
|
||||
$sql .= " AND devis.mentions IN ($mentionsFilterPlaceholders)";
|
||||
$conditions = array_merge($conditions, $mentionFilters);
|
||||
}
|
||||
$sql.= " ORDER BY devis.date ASC;";
|
||||
$devisList = $this->execSQLNoJsonReturn($sql,$conditions);
|
||||
|
||||
return $devisList;
|
||||
}
|
||||
|
||||
private function getDevisDataByClientIdAndMonthYear($clientId,$month,$year){
|
||||
private function getDevisDataByClientIdAndMonthYear($clientId,$month,$year,$mentionFilters = []){
|
||||
$sql = "SELECT
|
||||
devis.id as devis_id,
|
||||
devis.date as devis_date,
|
||||
@ -4324,6 +4343,7 @@ class Bdd {
|
||||
devis.comment as devis_comment,
|
||||
devis.order_number as order_number,
|
||||
devis.case_number as case_number,
|
||||
devis.devis_full_number as devis_full_number,
|
||||
client.nom as client_nom,
|
||||
client.entreprise as client_entreprise,
|
||||
client.adresse as client_adresse,
|
||||
@ -4354,14 +4374,16 @@ class Bdd {
|
||||
WHERE
|
||||
client.id = ? AND
|
||||
YEAR(devis.date) = ? AND
|
||||
MONTH(devis.date) = ?
|
||||
ORDER BY devis.date ASC;";
|
||||
MONTH(devis.date) = ?";
|
||||
|
||||
$devisList = $this->execSQLNoJsonReturn($sql,[
|
||||
$clientId,
|
||||
$year,
|
||||
$month
|
||||
]);
|
||||
$conditions = [$clientId,$year,$month];
|
||||
if(!empty($mentionFilters)){
|
||||
$mentionsFilterPlaceholders = implode(',', array_fill(0, count($mentionFilters), '?'));
|
||||
$sql .= " AND devis.mentions IN ($mentionsFilterPlaceholders)";
|
||||
$conditions = array_merge($conditions, $mentionFilters);
|
||||
}
|
||||
$sql.= " ORDER BY devis.date ASC;";
|
||||
$devisList = $this->execSQLNoJsonReturn($sql,$conditions);
|
||||
|
||||
return $devisList;
|
||||
}
|
||||
@ -4378,7 +4400,9 @@ class Bdd {
|
||||
facture.date_paiement,
|
||||
facture.num,
|
||||
facture.fk_client_id,
|
||||
facture.fk_client_group_facturation_id
|
||||
facture.fk_client_group_facturation_id,
|
||||
facture.month,
|
||||
facture.year
|
||||
FROM ".$this->tableprefix."facture as facture
|
||||
WHERE facture.id = ? AND
|
||||
facture.facture_type = ?
|
||||
@ -4398,11 +4422,13 @@ class Bdd {
|
||||
$currentConfig = $configuration[0];
|
||||
$tvaValue = $currentConfig->tva_default;
|
||||
$isFactureSingleClient = $facture['fk_client_id'] != null
|
||||
&& $facture['fk_client_id'] != 0
|
||||
&& ($facture['fk_client_group_facturation_id'] == null || $facture['fk_client_group_facturation_id'] == 0);
|
||||
&& $facture['fk_client_id'] != 0;
|
||||
|
||||
$devisMentionFilters = [
|
||||
DevisMentionConstant::FACTURED,
|
||||
DevisMentionConstant::FACTURED_FORMATTED
|
||||
];
|
||||
|
||||
$devisList = [];
|
||||
if($isFactureSingleClient){
|
||||
$client = $this->getClientById($facture['fk_client_id']);
|
||||
$facture['group_name'] = $client["client_nom"];
|
||||
@ -4413,7 +4439,8 @@ class Bdd {
|
||||
$devisList = $this->getDevisDataByClientIdAndMonthYear(
|
||||
$facture['fk_client_id'],
|
||||
$facture['month'],
|
||||
$facture['year']
|
||||
$facture['year'],
|
||||
$devisMentionFilters
|
||||
);
|
||||
}
|
||||
else{
|
||||
@ -4426,7 +4453,8 @@ class Bdd {
|
||||
$devisList = $this->getDevisDataByClientGroupFacturationIdAndMonthYear(
|
||||
$facture['fk_client_group_facturation_id'],
|
||||
$facture['month'],
|
||||
$facture['year']
|
||||
$facture['year'],
|
||||
$devisMentionFilters
|
||||
);
|
||||
}
|
||||
$factureTotalHt= 0;
|
||||
@ -4436,7 +4464,7 @@ class Bdd {
|
||||
$totalHt = 0;
|
||||
$totalTva = 0;
|
||||
$totalTtc = 0;
|
||||
$devisProducts = $this->getDevisProduits($currentDevis['id']);
|
||||
$devisProducts = $this->getDevisProduits($currentDevis['devis_id']);
|
||||
foreach($devisProducts as $currentProduct){
|
||||
$valueHt = $currentProduct['produit_price'] * $currentProduct['quantite'];
|
||||
$valueTtc = PriceHelpers::calculPriceWithVatValue($valueHt,$tvaValue);
|
||||
@ -4451,8 +4479,8 @@ class Bdd {
|
||||
$factureTotalHt += $totalHt;
|
||||
$factureTotalTtc += $totalTtc;
|
||||
$factureTotalTva += $totalTva;
|
||||
$facture["devisList"][] = $currentDevis;
|
||||
}
|
||||
$facture["devisList"] = $devisList;
|
||||
$facture["totalHt"] = $factureTotalHt;
|
||||
$facture["totalTtc"] = $factureTotalTtc;
|
||||
$facture["totalTva"] = $factureTotalTva;
|
||||
|
||||
@ -13,4 +13,8 @@ class PriceHelpers
|
||||
return ($price * (1 + ($vat / 100)));
|
||||
}
|
||||
|
||||
public static function formatDecimalPrice($price){
|
||||
return number_format($price,2,'.','');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -83,7 +83,7 @@ class InvoiceOgfPdfHandler extends InvoiceGroupPdfHandler {
|
||||
$this->Cell(60, 7, utf8_decode(html_entity_decode($this->factureData['group_name'])), 1, 0, 'C');
|
||||
$this->Cell(40, 7, $this->factureData['num'], 1, 0, 'C');
|
||||
$this->Cell(40, 7, $factureDateEcheance, 1, 0, 'C');
|
||||
$this->Cell(34, 7, $this->factureData["order_number"], 1, 1, 'C');
|
||||
$this->Cell(34, 7, $this->factureData["facture_order_number"], 1, 1, 'C');
|
||||
|
||||
$this->startingYOfArticlesTable = 85;
|
||||
}
|
||||
|
||||
@ -29,6 +29,7 @@ namespace OCA\Gestion\Service;
|
||||
use DateTime;
|
||||
use OCA\Gestion\Constants\BddConstant;
|
||||
use OCA\Gestion\Constants\ClientTemplateTypeConstant;
|
||||
use OCA\Gestion\Constants\DevisMentionConstant;
|
||||
use OCA\Gestion\Constants\FactureTypeConstant;
|
||||
use OCA\Gestion\Constants\MultipleFactureTypeConstant;
|
||||
use OCA\Gestion\Db\Bdd;
|
||||
@ -252,9 +253,13 @@ class InvoicePdfService {
|
||||
$factureId = null;
|
||||
$fkClientId = null;
|
||||
$fkClientGroupFacturationId = null;
|
||||
$devisMentionFiltersToBeInvoiced = [
|
||||
DevisMentionConstant::NEW,
|
||||
DevisMentionConstant::MENTION
|
||||
];
|
||||
if($clientType == MultipleFactureTypeConstant::CLIENT_FILTER_TYPE){
|
||||
$factureId = $this->gestionBdd->getFactureIdByClientIdAndMonthYear($clientId,$month,$year);
|
||||
$devisIds = $this->gestionBdd->getDevisIdsByClientIdAndMonthYear($clientId,$month,$year);
|
||||
$devisIds = $this->gestionBdd->getDevisIdsByClientIdAndMonthYear($clientId,$month,$year,$devisMentionFiltersToBeInvoiced);
|
||||
$fkClientId = $clientId;
|
||||
}
|
||||
else{
|
||||
|
||||
@ -6,4 +6,7 @@ export const CanceledDevisMentionConstant = "CANCELED";
|
||||
|
||||
export const FactureStatusPaid = "PAID";
|
||||
export const FactureStatusPending = "PENDING";
|
||||
export const FactureStatusCanceled = "CANCELED";
|
||||
export const FactureStatusCanceled = "CANCELED";
|
||||
|
||||
export const FactureTypeSingle = "SINGLE";
|
||||
export const FactureTypeGroup = "GROUP";
|
||||
12
gestion/src/js/factureGroupDetails.js
Normal file
12
gestion/src/js/factureGroupDetails.js
Normal file
@ -0,0 +1,12 @@
|
||||
import "@nextcloud/dialogs/dist/index.css";
|
||||
import "datatables.net-dt/css/jquery.dataTables.css";
|
||||
import "../css/mycss.css";
|
||||
import { globalConfiguration } from "./modules/mainFunction.mjs";
|
||||
import "./listener/main_listener";
|
||||
import "./listener/invoiceListener";
|
||||
|
||||
window.addEventListener("DOMContentLoaded", function () {
|
||||
globalConfiguration();
|
||||
});
|
||||
|
||||
|
||||
@ -2,6 +2,7 @@ import {showError, showSuccess } from "@nextcloud/dialogs";
|
||||
import {baseUrl, hideLoader, showLoader} from "../modules/mainFunction.mjs";
|
||||
import { Facture } from "../objects/facture.mjs";
|
||||
import DataTable from "datatables.net";
|
||||
import { generateUrl } from "@nextcloud/router";
|
||||
window.addEventListener("DOMContentLoaded", function () {
|
||||
|
||||
const today = new Date();
|
||||
@ -128,4 +129,10 @@ document.onchange = function(event) {
|
||||
filterTypeInput.value = filterType;
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
$('body').on('click', '.goToDevisDetails', function () {
|
||||
let devisId = $(this).data('devis-id');
|
||||
let url = generateUrl(`/apps/gestion/devis/${devisId}/show`);
|
||||
window.location.href = url;
|
||||
});
|
||||
@ -2,6 +2,7 @@ import { showError } from "@nextcloud/dialogs";
|
||||
import { generateUrl } from "@nextcloud/router";
|
||||
import { baseUrl, LoadDT, showDone } from "../modules/mainFunction.mjs";
|
||||
import { Devis } from "./devis.mjs";
|
||||
import { FactureTypeSingle } from "../constants/invoiceConstant.js";
|
||||
|
||||
export class Facture {
|
||||
|
||||
@ -32,6 +33,13 @@ export class Facture {
|
||||
paymentDate = paymentDate.toLocaleDateString("fr-FR");
|
||||
}
|
||||
this.payment_date = paymentDate;
|
||||
this.factureType = myresp.facture_type;
|
||||
if(this.factureType == FactureTypeSingle){
|
||||
this.baseUrl = generateUrl(`/apps/gestion/facture/${this.id}/show`);
|
||||
}
|
||||
else{
|
||||
this.baseUrl = generateUrl(`/apps/gestion/facture/${this.id}/groupDetails`);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
137
gestion/templates/content/factureGroupDetails.php
Normal file
137
gestion/templates/content/factureGroupDetails.php
Normal file
@ -0,0 +1,137 @@
|
||||
<?php
|
||||
|
||||
use OC\URLGenerator;
|
||||
use OCA\Gestion\Helpers\PriceHelpers;
|
||||
$facture = $_['facture'];
|
||||
$factureOrderNumber = $facture->facture_order_number == '' ? '-' : $facture->facture_order_number;
|
||||
$factureCaseNumber = $facture->facture_case_number == '' ? '-' : $facture->facture_case_number;
|
||||
$currentConfig = json_decode($_['configuration'])[0];
|
||||
?>
|
||||
<div class="bootstrap-iso">
|
||||
<div id="factureId" data-id="<?php echo $facture->id; ?>"></div>
|
||||
<div id="factureIdentifier" data-id="<?php echo $facture->id; ?>"></div>
|
||||
<h2 class="mt-3 mb-3 text-center"> <?php echo ('Facture n° '.$facture->num); ?>
|
||||
</h2>
|
||||
<hr />
|
||||
<div class="row">
|
||||
<div class="col-5 h-100 m-0" style="min-height:250px;">
|
||||
<h5 class="p-3 m-0 text-dark text-center border border-2 border-dark"><?php p($l->t('FROM')); ?>
|
||||
<?php echo $currentConfig->entreprise; ?></h5>
|
||||
<p style="min-height:180px;"
|
||||
class="p-3 m-0 h-100 text-center text-dark text-center border border-top-0 border-2 border-dark">
|
||||
<?php echo $currentConfig->prenom . " " . $currentConfig->nom; ?><br />
|
||||
<?php echo $currentConfig->adresse; ?><br />
|
||||
<?php echo $currentConfig->mail; ?><br />
|
||||
<?php echo $currentConfig->telephone; ?><br />
|
||||
<span id="nothing"></span><br />
|
||||
</p>
|
||||
</div>
|
||||
<div class="col-2 h-100 m-0" style="min-height:250px;">
|
||||
<?php
|
||||
if (isset($_['logo']) && $_['logo'] !== "nothing") {
|
||||
echo "<center><a><img alt='" . $l->t('Company logo') . "' class=\"img-fluid\" src=\"data:image/png;base64, " . $_['logo'] . "\"/></a></center>";
|
||||
} else {
|
||||
echo "<span style='font-size:12px' id='Company-logo' data-html2canvas-ignore><b><center>" . $l->t('You can add your company logo here.') . "</center></b><br/><i>" . $l->t('To add a logo, drop the logo.png file in ".gestion" folder at the root of your Nextcloud Files app. Remember to set "Show hidden files".') . "</i><br/><br/><center>" . $l->t('This message will not appear on generated PDF.') . "</center></span>";
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<div class="col-5 h-100 m-0" style="min-height:250px;">
|
||||
<h5 class="p-3 m-0 text-dark text-center border border-2 border-dark"><?php p($l->t('TO')); ?>
|
||||
<span><?php echo $facture->group_name; ?></span></h5>
|
||||
<p style="min-height:180px;"
|
||||
class="p-3 m-0 h-100 text-center text-dark text-center border border-top-0 border-2 border-dark">
|
||||
<span><?php echo $facture->group_name; ?></span><br />
|
||||
<span><?php echo $facture->client_name; ?></span><br />
|
||||
<span><?php echo $facture->client_address; ?></span><br />
|
||||
<span><?php echo $facture->mail; ?></span><br />
|
||||
<span><?php echo $facture->siret; ?></span><br />
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<hr />
|
||||
<div class="row">
|
||||
<div class="col col-md">
|
||||
<label class="fw-bold">Commande :</label>
|
||||
<div class="col col-xl mb-3 text-center editable" style="display:inline" data-table="facture"
|
||||
data-column="facture_order_number" data-id="<?php echo $facture->id; ?>">
|
||||
<?php echo $factureOrderNumber; ?>
|
||||
</div>
|
||||
</div>
|
||||
<hr />
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col col-md">
|
||||
<label class="fw-bold">Numéro de dossier :</label>
|
||||
<div class="col col-xl mb-3 text-center editable" style="display:inline" data-table="facture"
|
||||
data-column="facture_case_number" data-id="<?php echo $facture->id; ?>">
|
||||
<?php echo $factureCaseNumber; ?>
|
||||
</div>
|
||||
</div>
|
||||
<hr />
|
||||
</div>
|
||||
<div class="table-responsive">
|
||||
<table id="factureGroupId" class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><?php p($l->t('Devis')); ?></th>
|
||||
<th><?php p($l->t('Defunt')); ?></th>
|
||||
<th><?php p($l->t('Agence')); ?></th>
|
||||
<th><?php p($l->t('Prix HT')); ?></th>
|
||||
<th><?php p($l->t('Prix TTC')); ?></th>
|
||||
<th><?php p($l->t('Actions')); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
$devisList = $facture->devisList;
|
||||
foreach ($devisList as $currentDevis) {
|
||||
?>
|
||||
<tr>
|
||||
<td><?php echo $currentDevis->devis_full_number; ?></td>
|
||||
<td><?php echo $currentDevis->defunt_nom; ?></td>
|
||||
<td><?php echo $currentDevis->client_nom; ?></td>
|
||||
<td><?php echo PriceHelpers::formatDecimalPrice($currentDevis->totalHt).'€'; ?></td>
|
||||
<td><?php echo PriceHelpers::formatDecimalPrice($currentDevis->totalTtc).'€'; ?></td>
|
||||
<td>
|
||||
<div style="display:inline-block;margin-right:0px;width:80%;">
|
||||
<button class="goToDevisDetails" data-devis-id="<?php echo $currentDevis->devis_id; ?>">Ouvrir</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div>
|
||||
<button id="exportFactureToPdf" type="button" class="mb-2 btn btn-outline-success" data-html2canvas-ignore data-name=""><?php p($l->t('Save in Nextcloud'));?></button>
|
||||
<button id="mailGestion" type="button" class="mb-2 btn btn-outline-success sendmail" data-html2canvas-ignore data-name=""><?php p($l->t('Send by email'));?></button>
|
||||
</div>
|
||||
<div class="mt-0 table-responsive">
|
||||
<table id="totalFactureGroupPrice" class="table table-striped table-xl">
|
||||
<thead class="bg-dark text-white">
|
||||
<tr>
|
||||
<th class="text-center"><?php p($l->t('Total without VAT')); ?></th>
|
||||
<th class="text-center"><?php p($l->t('VAT Rate')); ?></th>
|
||||
<th class="text-center"><?php p($l->t('Total VAT')); ?></th>
|
||||
<th class="text-center"><?php p($l->t('Total Price')); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="text-center"><?php echo (PriceHelpers::formatDecimalPrice($facture->totalHt).'€'); ?></td>
|
||||
<td class="text-center"><?php echo (PriceHelpers::formatDecimalPrice($currentConfig->tva_default).'€'); ?></td>
|
||||
<td class="text-center"><?php echo (PriceHelpers::formatDecimalPrice($facture->totalTva).'€'); ?></td>
|
||||
<td class="text-center"><?php echo (PriceHelpers::formatDecimalPrice($facture->totalTtc).'€'); ?></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="col m-0 pb-0 alert alert-info text-center">
|
||||
<p><span id="mentions_default"><?php p($l->t('Please set in global configuration')); ?></span></p>
|
||||
</div>
|
||||
<hr />
|
||||
<div class="col m-0 pb-0 alert alert-info text-center">
|
||||
<p><?php echo $currentConfig->entreprise; ?><br /><?php echo $currentConfig->adresse; ?><br /><?php echo $currentConfig->legal_one; ?><br /><?php echo $currentConfig->legal_two; ?>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
18
gestion/templates/factureGroupDetails.php
Normal file
18
gestion/templates/factureGroupDetails.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
style('gestion', array('style'));
|
||||
script('gestion', array('factureGroupDetails.app', '814.app', '856.app'));
|
||||
?>
|
||||
<div id="app">
|
||||
<div id="app-navigation">
|
||||
<?php print_unescaped($this->inc('navigation/index')); ?>
|
||||
<?php print_unescaped($this->inc('settings/index')); ?>
|
||||
</div>
|
||||
|
||||
<div id="app-content">
|
||||
<div id="app-content-wrapper">
|
||||
<?php print_unescaped($this->inc('content/changelog')); ?>
|
||||
<?php print_unescaped($this->inc('content/factureGroupDetails')); ?>
|
||||
<?php print_unescaped($this->inc('loader')); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -31,6 +31,7 @@ module.exports =
|
||||
clientGroup: './src/js/clientGroup.js',
|
||||
clientGroupFacturation : './src/js/clientGroupFacturation.js',
|
||||
pdf: './src/js/pdf.js',
|
||||
factureGroupDetails: './src/js/factureGroupDetails.js'
|
||||
},
|
||||
output: {
|
||||
filename: '../js/[name].app.js',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user