<div class="bg-dark border-right" id="sidebar-wrapper">
<div class="sidebar-heading"><a href="javascript:location.href='index.html';"><img src="img/creorga.png" style="width: 140px;"><br/>Creorga</a></div>
<div class="list-group list-group-flush">
- <a class="list-group-item list-group-item-action bg-light" href="javascript:userapp.loadmodule('dashboard');">Dashboard</a>
+ <!-- <a class="list-group-item list-group-item-action bg-light" href="javascript:userapp.loadmodule('dashboard');">Dashboard</a> -->
<a class="list-group-item list-group-item-action bg-light" href="javascript:userapp.loadmodule('childs');">Enfants</a>
<a class="list-group-item list-group-item-action bg-light" href="javascript:userapp.loadmodule('presences');">Présences</a>
<a class="list-group-item list-group-item-action bg-light" href="javascript:userapp.loadmodule('persons');">Personnes de références</a>
- <a class="list-group-item list-group-item-action bg-light" href="javascript:userapp.loadmodule('accounting');">Décompte</a>
- <a class="list-group-item list-group-item-action bg-light" href="javascript:userapp.loadmodule('staff');">Staff</a>
- <a class="list-group-item list-group-item-action bg-light" href="javascript:userapp.loadmodule('vacancy');">Congés</a>
- <a class="list-group-item list-group-item-action bg-light" href="javascript:userapp.loadmodule('waitlist');">Liste d'attente</a>
+ <!-- <a class="list-group-item list-group-item-action bg-light" href="javascript:userapp.loadmodule('accounting');">Décompte</a> -->
+ <!-- <a class="list-group-item list-group-item-action bg-light" href="javascript:userapp.loadmodule('staff');">Staff</a> -->
+ <!-- <a class="list-group-item list-group-item-action bg-light" href="javascript:userapp.loadmodule('vacancy');">Congés</a> -->
+ <!-- <a class="list-group-item list-group-item-action bg-light" href="javascript:userapp.loadmodule('waitlist');">Liste d'attente</a> -->
<a class="list-group-item list-group-item-action bg-light" href="javascript:userapp.loadmodule('calendar');">Calendriers</a>
- <a class="list-group-item list-group-item-action bg-light" href="javascript:userapp.loadmodule('forms');">Formulaires</a>
- <a class="list-group-item list-group-item-action bg-light" href="javascript:userapp.loadmodule('logbook');">Livrets</a>
+ <!-- <a class="list-group-item list-group-item-action bg-light" href="javascript:userapp.loadmodule('forms');">Formulaires</a> -->
+ <!-- <a class="list-group-item list-group-item-action bg-light" href="javascript:userapp.loadmodule('logbook');">Livrets</a> -->
<a class="list-group-item list-group-item-action bg-light" href="javascript:userapp.loadmodule('settings');">Configuration</a></li>
</div>
</div>
<script>if (typeof module === 'object') {window.module = module; module = undefined;}</script>
<script src="node_modules/jquery/dist/jquery.min.js"></script>
<script src="node_modules/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
-<script src="node_modules/store2/dist/store2.min.js"></script>
+<!-- <script src="node_modules/store2/dist/store2.min.js"></script> -->
<script src="js/app.js"></script>
<script>if (window.module) module = window.module;</script>
</body>
// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.
let mainWindow
-let userdatapath = app.getPath('userData');
-
function createWindow () {
// Create the browser window.
var parameters = [];
if (os.platform() == "win32"){
executablePath = "C:\\Strawberry\\perl\\bin\\perl.exe";
- parameters = ["C:\\Users\\ksaff\\Workspace\\DKSService\\dkslocalserver.pl"];
+ parameters = ["C:\\Users\\ksaff\\Workspace\\dks_server\\dkslocalserver.pl"];
} else { //os.platform() == "darwin"
executablePath = "/Users/kilian/perl5/perlbrew/perls/perl-5.28.1/bin/perl";
- parameters = ["/Users/kilian/Workspace/DKSService/dkslocalserver.pl"];
+ parameters = ["/Users/kilian/Workspace/dks_server/dkslocalserver.pl"];
}
mainWindow = new BrowserWindow({
if(err){
console.error('stderr',err);
} else {
-
-
+ // var test = app.getPath('USERPROFILE');
+ // console.log("Path:" + test);
+ // console.log(data.toString());
win.show()
}
mainWindow.show()
// Open the DevTools.
mainWindow.webContents.openDevTools()
-
+
// Emitted when the window is closed.
mainWindow.on('closed', function () {
// Dereference the window object, usually you would store windows
})
}
+
// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
+++ /dev/null
-
-<!DOCTYPE html>
-
-<html lang="fr">
-<head>
- <meta charset="utf-8">
- <title>Décompte</title>
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <meta http-equiv="cache-control" content="max-age=0" />
- <meta http-equiv="cache-control" content="no-cache" />
- <meta http-equiv="expires" content="0" />
- <meta http-equiv="expires" content="Tue, 01 Jan 1970 1:00:00 GMT" />
- <meta http-equiv="pragma" content="no-cache" />
- <link href="../../web/css/bootstrap.min.css" rel="stylesheet" type="text/css">
- <!--<link href="../../web/css/bootstrap-theme.min.css" rel="stylesheet" type="text/css">-->
- <link href="../../web/css/datatables.min.css" rel="stylesheet" type="text/css">
- <link href="../../web/css/dataTables.bootstrap.min.css" rel="stylesheet" type="text/css">
- <link href="../../web/css/bootstrap-datetimepicker.min.css" rel="stylesheet" type="text/css">
- <!-- <link href="../../web/css/bootstrap-timepicker.min.css" rel="stylesheet" type="text/css"> -->
- <link href="../../web/css/bootstrap-multiselect.css" rel="stylesheet" type="text/css">
- <link href="../../web/css/glyphicons.css" rel="stylesheet" type="text/css">
- <link href="../../web/css/creorga.css" rel="stylesheet" type="text/css">
- <style type="text/css">
- .dataTables_filter {
- margin-top: -30px;
- }
- </style>
-</head>
-
-<body>
- <div class="container-fluid" style="padding-top: 5px;">
- <div class="form-inline" id="mnuacc">
- <div class="input-group month">
- <span class="input-group-addon">du mois:</span>
- <input type="date" class="form-control" value="" placeholder="mm.yyyy" style="width: 80px;" id="accmonth" onchange="set_accmonth();">
- <span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
- </div>
- <button class="btn btn-primary" onclick="onpreviousmonth();" ><span class="glyphicon glyphicon-chevron-left"></span></button>
- <button class="btn btn-primary" onclick="onnextmonth();" ><span class="glyphicon glyphicon-chevron-right"></span></button>
-
- <button class="btn btn-primary" onclick="generatecsv();" ><span class="glyphicons glyphicons-file-export"></span> Export CSV Check-Service</button>
- <button class="btn btn-info" onclick="openmonthlypdf();" style="display: none;" id="monthlypdf"><span class="glyphicons glyphicons-file"></span> PDF des Factures importées et triées</button>
- <!--<div class="input-group">
- <div class="input-group-addon">Colonnes <span class="glyphicons glyphicons-eye-close" aria-hidden="true"></span></div>
- <select id="hidden_columns" multiple="multiple" onchange="onhidecolumn(this.id);">
- </select>
- </div>-->
- </div>
- <div>
- <table class="display compact dataTable cell-border" style="width: 100%;" id="tbl_accounting" role="grid"></table>
- </div>
- </div>
- <div class="modal fade" id="edit_accounting">
- <div class="modal-dialog" style="width: 850px; max-width: 850px;">
- <div class="modal-content">
- <div class="modal-header">
- <button data-dismiss="modal" class="close" type="button"><span aria-hidden="true">x</span><span class="sr-only">Close</span></button>
- <h4 class="modal-title">Editer facture</h4>
- </div>
- <div class="modal-body" style="max-height: calc(100vh - 200px);overflow-y: auto; ">
-
- <div id="frmeditaccounting">
- <input type="hidden" value="0" id="uuid" />
- <input type="hidden" value="" id="action" />
- <input type="hidden" value="" id="childuuid" />
- <div class="form-group">
- <div class="checkbox" >
- <input type="checkbox" value="1" id="nocheckservice">
- <label for="nocheckservice">facture NON Check-Service</label>
- </div>
- </div>
- <div class="form-group">
- <label for="name">Enfant</label>
- <input type="text" value="" id="childname" nullable="true" readonly="true" class="form-control">
- </div>
- <div class="form-group">
- <label for="name">Référence</label>
- <input type="text" value="" id="reference" nullable="true" class="form-control">
- </div>
- <div class="form-group">
- <label for="invoicefile">Fichier</label>
- <input type="file" value="" id="invoicefile" nullable="true" accept=".pdf" class="form-control" disabled="1">
- </div>
- <div class="form-group col-md-6" id="date-container">
- <label for="invoicedate">Date de la Facture</label>
-
- <div id="dt_invoicedate" class="input-group date">
- <input type="date" class="form-control" value="" placeholder="dd.mm.yyyy" id="invoicedate"><span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
- </div>
- </div>
- <div class="form-group col-md-6">
- <label for="invoiceamount">Somme facturé</label>
-
- <div class="input-group number">
- <input type="number" value="" id="invoiceamount" style="text-align: right;" min="0" nullable="false" class="form-control">
- <div class="input-group-addon">€</div>
- </div>
- </div>
- <div class="form-group col-md-6" id="date-container">
- <label for="payeddate">Date du Payement</label>
-
- <div id="dt_payeddate" class="input-group date">
- <input type="date" class="form-control" value="" widgetpos="top" placeholder="dd.mm.yyyy" id="payeddate"><span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
- </div>
- </div>
- <div class="form-group col-md-6">
- <label for="payedamount">Somme payé</label>
-
- <div class="input-group number">
- <input type="number" value="" id="payedamount" style="text-align: right;" min="0" nullable="false" class="form-control">
- <div class="input-group-addon">€</div>
- </div>
- </div>
- <div class="form-group col-md-12">
- <label for="payedamount">Somme prestation Check-Service</label>
-
- <div class="input-group number">
- <input type="number" value="" id="benefitamount" style="text-align: right;" min="0" nullable="false" class="form-control">
- <div class="input-group-addon">€</div>
- </div>
- </div>
- <div class="form-group col-md-4" id="date-container">
- <label for="reminderdate1">Date Rappel 1</label>
-
- <div id="dt_reminderdate1" class="input-group date">
- <input type="date" class="form-control" value="" widgetpos="top" placeholder="dd.mm.yyyy" id="reminderdate1"><span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
- </div>
- </div>
-
- <div class="form-group col-md-4" id="date-container">
- <label for="reminderdate2">Date Rappel 2</label>
-
- <div id="dt_reminderdate2" class="input-group date">
- <input type="date" class="form-control" value="" widgetpos="top" placeholder="dd.mm.yyyy" id="reminderdate2"><span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
- </div>
- </div>
-
- <div class="form-group col-md-4" id="date-container">
- <label for="reminderdate3">Date Rappel 3</label>
-
- <div id="dt_reminderdate3" class="input-group date">
- <input type="date" class="form-control" value="" widgetpos="top" placeholder="dd.mm.yyyy" id="reminderdate3"><span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
- </div>
- </div>
- </div>
- </div>
- <div class="modal-footer">
- <button aria-hidden="true" data-dismiss="modal" class="btn">Annuler</button> <button onclick="save_accounting();" class="btn btn-primary">OK</button>
- </div>
- </div>
-
-
- </div>
- </div>
- <div class="modal fade" id="confirm_delete_accounting">
- <div class="modal-dialog">
- <div class="modal-content">
- <div class="modal-header">
- <button data-dismiss="modal" class="close" type="button"><span aria-hidden="true">x</span><span class="sr-only">Close</span></button>
-
- <h4 class="modal-title">Supprimer Décompte</h4>
- </div><!-- dialog contents -->
-
- <div class="modal-body">
- Êtes vous sûre de supprimer ce décompte de facturation, payement et/ou prestation?<br>
-
- </div><!-- dialog buttons -->
-
- <div class="modal-footer">
- <button aria-hidden="true" data-dismiss="modal" class="btn">Non</button> <button onclick="delete_accounting();" class="btn btn-primary">Oui</button>
- </div>
- </div>
- </div>
- </div>
- <script src="../../web/js/jquery.min.js" type="text/javascript"></script>
- <script src="../../web/js/bootstrap.min.js" type="text/javascript"></script>
- <script src="../../web/js/datatables.min.js" type="text/javascript"></script>
- <script src="../../web/js/moment-with-locales.js" type="text/javascript"></script>
- <script src="../../web/js/bootstrap-datetimepicker.min.js" type="text/javascript"></script>
- <!-- <script src="../../web/js/bootstrap-timepicker.min.js" type="text/javascript"></script> -->
- <script src="../../web/js/bootstrap-multiselect.js" type="text/javascript"></script>
- <script src="chrome://creorga/content/js/navigation.js" type="text/javascript"></script>
- <script src="chrome://creorga/content/js/preferences.js" type="text/javascript"></script>
- <script src="chrome://creorga/content/js/system.js" type="text/javascript"></script>
- <script src="chrome://creorga/content/js/database.js" type="text/javascript"></script>
-
- <script src="../../web/js/labels.js" type="text/javascript"></script>
- <script src="js/accounting.js" type="text/javascript"></script>
- <script src="../../web/js/creorga.js" type="text/javascript"></script>
-
-</body>
-</html>
+++ /dev/null
-<?xml version="1.0"?>
-<!DOCTYPE overlay PUBLIC "-//MOZILLA//DTD XUL V1.0//EN"
-"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
-<overlay id="ov_accounting" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:html="http://www.w3.org/1999/xhtml">
- <toolbar id="co_maintoolbar" style="-moz-appearance: none;">
- <toolbarbutton type="menu" class="btn btn-default" id="tbb_accounting" insertafter="tbb_presences" label="Décompte" image="modules/accounting/img/accounting.png" orient="vertical">
- <menupopup class="tlbpopup" style="text-align: left;">
- <label value="Décompte" style="font-weight: bold;"/>
- <menuitem label="par mois" oncommand="navigation.load_appview('accounting','accounting', null,'Décompte par mois');" id="mnuaccountingmonth"/>
- <menuitem label="par enfant" oncommand="navigation.load_appview('accountingchild','accounting',null,'Décompte par enfant');" id="mnuaccountingchild"/>
- <menuitem label="factures ouvertes" oncommand="navigation.load_appview('accountingopeninvoice','accounting',null,'Factures ouvertes');" id="mnuaccountingopeninvoice"/>
- <menuseparator />
- <menuitem label="import Check-Services" oncommand="navigation.load_appview('checkservice','accounting',null,'Import Check Service');" id="mnuaccountingimport"/>
- <!--<menu label="Import PDF" id="mnuimportpdf">
- <menupopup style="text-align: left;">
- <menuitem label="Factures Check-Service" oncommand="tools.readinvoicepdf();" id="mnuaccountingimportinvoice"/>
- <menuitem label="Décompte des prestations" oncommand="tools.readbenefitstatement();" id="mnuaccountingbenefitstatement"/>
- </menupopup>
- </menu>-->
- <menuseparator />
- <label value="Bilan" style="font-weight: bold;"/>
- <menuitem label="Bilan annuelle" oncommand="navigation.load_appview('accountingyear','accounting',null,'Bilan annuelle');" id="mnuaccountingyear"/>
- </menupopup>
- </toolbarbutton>
- </toolbar>
-</overlay>
+++ /dev/null
-
-<!DOCTYPE html>
-
-<html lang="fr">
-<head>
- <meta charset="utf-8">
- <title>Décompte Enfant</title>
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <meta http-equiv="cache-control" content="max-age=0" />
- <meta http-equiv="cache-control" content="no-cache" />
- <meta http-equiv="expires" content="0" />
- <meta http-equiv="expires" content="Tue, 01 Jan 1970 1:00:00 GMT" />
- <meta http-equiv="pragma" content="no-cache" />
- <link href="../../web/css/bootstrap.min.css" rel="stylesheet" type="text/css">
- <!--<link href="../../web/css/bootstrap-theme.min.css" rel="stylesheet" type="text/css">-->
- <link href="../../web/css/datatables.min.css" rel="stylesheet" type="text/css">
- <link href="../../web/css/dataTables.bootstrap.min.css" rel="stylesheet" type="text/css">
- <link href="../../web/css/bootstrap-datetimepicker.min.css" rel="stylesheet" type="text/css">
- <!-- <link href="../../web/css/bootstrap-timepicker.min.css" rel="stylesheet" type="text/css"> -->
- <link href="../../web/css/bootstrap-multiselect.css" rel="stylesheet" type="text/css">
- <link href="../../web/css/glyphicons.css" rel="stylesheet" type="text/css">
- <link href="../../web/css/creorga.css" rel="stylesheet" type="text/css">
- <style type="text/css">
- .dataTables_filter {
- margin-top: -30px;
- }
- </style>
-</head>
-
-<body>
- <div class="container-fluid" style="padding-top: 5px;">
- <div class="form-inline" >
- <div class="input-group month btn-group">
- <span class="input-group-addon">du année:</span>
- <select id="accyear" class="form-control" style="width: 80px;" onchange="set_accyear();"></select>
- </span>
- </div>
- <div class="input-group">
- <span class="input-group-addon">du enfant:</span>
- <select class="form-control" value="" id="accchild" onchange="set_accchild();"></select>
- </div>
- <button class="btn btn-primary" onclick="newinvoice();" ><span class="glyphicons glyphicons-plus"></span> Nouvelle Facture</button>
- <!--<div class="input-group">
- <div class="input-group-addon">Colonnes <span class="glyphicons glyphicons-eye-close" aria-hidden="true"></span></div>
- <select id="hidden_columns" multiple="multiple" onchange="onhidecolumn(this.id);">
- </select>
- </div>-->
- </div>
- <div>
- <table class="display dataTable cell-border" style="width: 100%;" id="tbl_accounting" role="grid"></table>
- </div>
- </div>
- <div class="modal fade" id="edit_accounting">
- <div class="modal-dialog">
- <div class="modal-content">
- <div class="modal-header">
- <button data-dismiss="modal" class="close" type="button"><span aria-hidden="true">x</span><span class="sr-only">Close</span></button>
- <h4 class="modal-title" id="head_invoice">Editer facture</h4>
- </div>
- <div class="modal-body" style="max-height: calc(100vh - 300px);overflow-y: auto; ">
-
- <div id="frmeditaccounting">
- <input type="hidden" value="" id="uuid" />
- <input type="hidden" value="" id="action" />
- <input type="hidden" value="" id="childuuid" />
-
- <div class="form-group">
- <div class="checkbox" >
- <input type="checkbox" value="1" id="nocheckservice">
- <label for="nocheckservice">facture NON Check-Service</label>
- </div>
- </div>
- <div class="form-group">
- <label for="name">Enfant</label>
- <input type="text" value="" id="childname" nullable="true" readonly="true" class="form-control">
- </div>
- <div class="form-group">
- <label for="name">Référence</label>
- <input type="text" value="" id="reference" nullable="true" class="form-control">
- </div>
- <div class="form-group">
- <label for="invoicefile">Fichier</label>
- <input type="file" value="" id="invoicefile" nullable="true" class="form-control">
- </div>
- <div class="form-group col-md-6" id="date-container">
- <label for="invoicedate">Date de la Facture</label>
-
- <div id="dt_invoicedate" class="input-group date">
- <input type="date" class="form-control" value="" limits="0" placeholder="dd.mm.yyyy" id="invoicedate"><span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
- </div>
- </div>
- <div class="form-group col-md-6">
- <label for="invoiceamount">Somme facturé</label>
-
- <div class="input-group number">
- <input type="number" value="" id="invoiceamount" style="text-align: right;" min="0" nullable="false" class="form-control">
- <div class="input-group-addon">€</div>
- </div>
- </div>
- <div class="form-group col-md-6" id="date-container">
- <label for="payeddate">Date du Payement</label>
-
- <div id="dt_payeddate" class="input-group date">
- <input type="date" class="form-control" value="" limits="0" placeholder="dd.mm.yyyy" id="payeddate"><span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
- </div>
- </div>
- <div class="form-group col-md-6">
- <label for="payedamount">Somme payé</label>
-
- <div class="input-group number">
- <input type="number" value="" id="payedamount" style="text-align: right;" min="0" nullable="false" class="form-control">
- <div class="input-group-addon">€</div>
- </div>
- </div>
- <div class="form-group col-md-12">
- <label for="payedamount">Somme prestation Check-Service</label>
-
- <div class="input-group number">
- <input type="number" value="" id="benefitamount" style="text-align: right;" min="0" nullable="false" class="form-control">
- <div class="input-group-addon">€</div>
- </div>
- </div>
- <div class="form-group col-md-4" id="date-container">
- <label for="reminderdate1">Date Rappel 1</label>
-
- <div id="dt_reminderdate1" class="input-group date">
- <input type="date" class="form-control" value="" limits="0" placeholder="dd.mm.yyyy" id="reminderdate1"><span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
- </div>
- </div>
-
- <div class="form-group col-md-4" id="date-container">
- <label for="reminderdate2">Date Rappel 2</label>
-
- <div id="dt_reminderdate2" class="input-group date">
- <input type="date" class="form-control" value="" limits="0" placeholder="dd.mm.yyyy" id="reminderdate2"><span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
- </div>
- </div>
-
- <div class="form-group col-md-4" id="date-container">
- <label for="reminderdate3">Date Rappel 3</label>
-
- <div id="dt_reminderdate3" class="input-group date">
- <input type="date" class="form-control" value="" limits="0" placeholder="dd.mm.yyyy" id="reminderdate3"><span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
- </div>
- </div>
- </div>
- </div>
- <div class="modal-footer">
- <button aria-hidden="true" data-dismiss="modal" class="btn">Annuler</button> <button onclick="save_accounting();" class="btn btn-primary">OK</button>
- </div>
- </div>
- </div>
- </div>
- <div class="modal fade" id="confirm_delete_accounting">
- <div class="modal-dialog">
- <div class="modal-content">
- <div class="modal-header">
- <button data-dismiss="modal" class="close" type="button"><span aria-hidden="true">x</span><span class="sr-only">Close</span></button>
-
- <h4 class="modal-title">Supprimer Décompte</h4>
- </div><!-- dialog contents -->
-
- <div class="modal-body">
- Êtes vous sûre de supprimer ce décompte de facturation, payement et/ou prestation?<br>
-
- </div><!-- dialog buttons -->
-
- <div class="modal-footer">
- <button aria-hidden="true" data-dismiss="modal" class="btn">Non</button> <button onclick="delete_accounting();" class="btn btn-primary">Oui</button>
- </div>
- </div>
- <script src="../../web/js/jquery.min.js" type="text/javascript"></script>
- <script src="../../web/js/bootstrap.min.js" type="text/javascript"></script>
- <script src="../../web/js/datatables.min.js" type="text/javascript"></script>
- <script src="../../web/js/moment-with-locales.js" type="text/javascript"></script>
- <script src="../../web/js/bootstrap-datetimepicker.min.js" type="text/javascript"></script>
- <!-- <script src="../../web/js/bootstrap-timepicker.min.js" type="text/javascript"></script> -->
- <script src="../../web/js/bootstrap-multiselect.js" type="text/javascript"></script>
- <script src="chrome://creorga/content/js/navigation.js" type="text/javascript"></script>
- <script src="chrome://creorga/content/js/preferences.js" type="text/javascript"></script>
- <script src="chrome://creorga/content/js/system.js" type="text/javascript"></script>
- <script src="chrome://creorga/content/js/database.js" type="text/javascript"></script>
-
- <script src="../../web/js/labels.js" type="text/javascript"></script>
- <script src="js/accountingchild.js" type="text/javascript"></script>
- <script src="../../web/js/creorga.js" type="text/javascript"></script>
-
-</body>
-</html>
+++ /dev/null
-
-<!DOCTYPE html>
-
-<html lang="fr">
-<head>
- <meta charset="utf-8">
- <title>Factures ouvertes</title>
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <meta http-equiv="cache-control" content="max-age=0" />
- <meta http-equiv="cache-control" content="no-cache" />
- <meta http-equiv="expires" content="0" />
- <meta http-equiv="expires" content="Tue, 01 Jan 1970 1:00:00 GMT" />
- <meta http-equiv="pragma" content="no-cache" />
- <link href="../../web/css/bootstrap.min.css" rel="stylesheet" type="text/css">
- <!--<link href="../../web/css/bootstrap-theme.min.css" rel="stylesheet" type="text/css">-->
- <link href="../../web/css/datatables.min.css" rel="stylesheet" type="text/css">
- <link href="../../web/css/dataTables.bootstrap.min.css" rel="stylesheet" type="text/css">
- <link href="../../web/css/bootstrap-datetimepicker.min.css" rel="stylesheet" type="text/css">
- <!-- <link href="../../web/css/bootstrap-timepicker.min.css" rel="stylesheet" type="text/css"> -->
- <link href="../../web/css/bootstrap-multiselect.css" rel="stylesheet" type="text/css">
- <link href="../../web/css/glyphicons.css" rel="stylesheet" type="text/css">
- <link href="../../web/css/creorga.css" rel="stylesheet" type="text/css">
- <style type="text/css">
- .dataTables_filter {
- margin-top: 15px;
- }
- </style>
-</head>
-
-<body>
- <div class="container-fluid" style="padding-top: 5px;">
- <div>
- <table class="display dataTable cell-border" style="width: 100%;" id="tbl_accounting" role="grid"></table>
- </div>
- </div>
- <div class="modal fade" id="edit_accounting">
- <div class="modal-dialog">
- <div class="modal-content">
- <div class="modal-header">
- <button data-dismiss="modal" class="close" type="button"><span aria-hidden="true">x</span><span class="sr-only">Close</span></button>
- <h4 class="modal-title">Editer la facturation</h4>
- </div>
- <div class="modal-body" style="max-height: calc(100vh - 300px);overflow-y: auto; ">
-
- <div id="frmeditaccounting">
- <input type="hidden" value="" id="uuid" />
- <input type="hidden" value="" id="action" />
- <input type="hidden" value="" id="childuuid" />
- <div class="form-group">
- <div class="checkbox" >
- <input type="checkbox" value="1" id="nocheckservice">
- <label for="nocheckservice">facture NON Check-Service</label>
- </div>
- </div>
- <div class="form-group">
- <label for="name">Enfant</label>
- <input type="text" value="" id="childname" nullable="true" readonly="true" class="form-control">
- </div>
- <div class="form-group">
- <label for="name">Référence</label>
- <input type="text" value="" id="reference" nullable="true" class="input- form-control">
- </div>
- <div class="form-group">
- <label for="invoicefile">Fichier</label>
- <input type="file" value="" id="invoicefile" nullable="true" class="form-control"">
- </div>
- <div class="form-group col-md-6" id="date-container">
- <label for="invoicedate">Date de la Facture</label>
-
- <div id="dt_invoicedate" class="input-group date">
- <input type="date" class="form-control" value="" limits="0" placeholder="dd.mm.yyyy" id="invoicedate"><span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
- </div>
- </div>
- <div class="form-group col-md-6">
- <label for="invoiceamount">Somme facturé</label>
-
- <div class="input-group number">
- <input type="number" value="" id="invoiceamount" style="text-align: right;" min="0" nullable="false" class="form-control">
- <div class="input-group-addon">€</div>
- </div>
- </div>
- <div class="form-group col-md-6" id="date-container">
- <label for="payeddate">Date du Payement</label>
-
- <div id="dt_payeddate" class="input-group date">
- <input type="date" class="form-control" value="" limits="0" placeholder="dd.mm.yyyy" id="payeddate"><span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
- </div>
- </div>
- <div class="form-group col-md-6">
- <label for="payedamount">Somme payé</label>
-
- <div class="input-group number">
- <input type="number" value="" id="payedamount" style="text-align: right;" min="0" nullable="false" class="form-control">
- <div class="input-group-addon">€</div>
- </div>
- </div>
- <div class="form-group col-md-12">
- <label for="payedamount">Somme prestation Check-Service</label>
-
- <div class="input-group number">
- <input type="number" value="" id="benefitamount" style="text-align: right;" min="0" nullable="false" class="form-control">
- <div class="input-group-addon">€</div>
- </div>
- </div>
- <div class="form-group col-md-4" id="date-container">
- <label for="reminderdate1">Date Rappel 1</label>
-
- <div id="dt_reminderdate1" class="input-group date">
- <input type="date" class="form-control" value="" limits="0" placeholder="dd.mm.yyyy" id="reminderdate1"><span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
- </div>
- </div>
-
- <div class="form-group col-md-4" id="date-container">
- <label for="reminderdate2">Date Rappel 2</label>
-
- <div id="dt_reminderdate2" class="input-group date">
- <input type="date" class="form-control" value="" limits="0" placeholder="dd.mm.yyyy" id="reminderdate2"><span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
- </div>
- </div>
-
- <div class="form-group col-md-4" id="date-container">
- <label for="reminderdate3">Date Rappel 3</label>
-
- <div id="dt_reminderdate3" class="input-group date">
- <input type="date" class="form-control" value="" limits="0" placeholder="dd.mm.yyyy" id="reminderdate3"><span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
- </div>
- </div>
- </div>
- </div>
- <div class="modal-footer">
- <button aria-hidden="true" data-dismiss="modal" class="btn">Annuler</button> <button onclick="save_accounting();" class="btn btn-primary">OK</button>
- </div>
- </div>
-
-
- </div>
- <script src="../../web/js/jquery.min.js" type="text/javascript"></script>
- <script src="../../web/js/bootstrap.min.js" type="text/javascript"></script>
- <script src="../../web/js/datatables.min.js" type="text/javascript"></script>
- <script src="../../web/js/moment-with-locales.js" type="text/javascript"></script>
- <script src="../../web/js/bootstrap-datetimepicker.min.js" type="text/javascript"></script>
- <!-- <script src="../../web/js/bootstrap-timepicker.min.js" type="text/javascript"></script> -->
- <script src="../../web/js/bootstrap-multiselect.js" type="text/javascript"></script>
- <script src="chrome://creorga/content/js/navigation.js" type="text/javascript"></script>
- <script src="chrome://creorga/content/js/preferences.js" type="text/javascript"></script>
- <script src="chrome://creorga/content/js/system.js" type="text/javascript"></script>
- <script src="chrome://creorga/content/js/database.js" type="text/javascript"></script>
-
- <script src="../../web/js/labels.js" type="text/javascript"></script>
- <script src="js/accountingopeninvoice.js" type="text/javascript"></script>
- <script src="../../web/js/creorga.js" type="text/javascript"></script>
-
-</body>
-</html>
+++ /dev/null
-<!DOCTYPE html>
-
-<html lang="fr">
-<head>
- <meta charset="utf-8">
- <title>Bilan</title>
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <meta http-equiv="cache-control" content="max-age=0" />
- <meta http-equiv="cache-control" content="no-cache" />
- <meta http-equiv="expires" content="0" />
- <meta http-equiv="expires" content="Tue, 01 Jan 1970 1:00:00 GMT" />
- <meta http-equiv="pragma" content="no-cache" />
- <link href="../../web/css/bootstrap.min.css" rel="stylesheet" type="text/css">
- <!--<link href="../../web/css/bootstrap-theme.min.css" rel="stylesheet" type="text/css">-->
- <link href="../../web/css/datatables.min.css" rel="stylesheet" type="text/css">
- <link href="../../web/css/dataTables.bootstrap.min.css" rel="stylesheet" type="text/css">
- <link href="../../web/css/bootstrap-datetimepicker.min.css" rel="stylesheet" type="text/css">
- <!-- <link href="../../web/css/bootstrap-timepicker.min.css" rel="stylesheet" type="text/css"> -->
- <link href="../../web/css/bootstrap-multiselect.css" rel="stylesheet" type="text/css">
- <link href="../../web/css/glyphicons.css" rel="stylesheet" type="text/css">
- <link href="../../web/css/creorga.css" rel="stylesheet" type="text/css">
- <style type="text/css">
- .dataTables_filter {
- margin-top: -30px;
- }
- td {
- vertical-align: top;
- }
- td:last-child{
- font-weight: bold;
- }
- </style>
-</head>
-
-<body>
- <div class="container-fluid" style="padding-top: 5px;">
- <div class="form-inline" id="mnuacc">
- <div class="input-group month btn-group">
- <span class="input-group-addon">du année:</span>
- <select id="accyear" class="form-control" style="width: 80px;" onchange="set_accyear();"></select>
- </div>
- <div class="input-group btn-group">
- <span class="input-group-addon">montants à visualiser:</span>
- <select id="filter_amounts" class="form-control" multiple="multiple" onchange="onselamount();">
- </select>
- </div>
- </div>
- <div>
- <table class="display dataTable cell-border" style="width: 100%;" id="tbl_accounting" role="grid"></table>
- </div>
-
- </div>
- <script src="../../web/js/jquery.min.js" type="text/javascript"></script>
- <script src="../../web/js/bootstrap.min.js" type="text/javascript"></script>
- <script src="../../web/js/datatables.min.js" type="text/javascript"></script>
- <script src="../../web/js/moment-with-locales.js" type="text/javascript"></script>
- <script src="../../web/js/bootstrap-datetimepicker.min.js" type="text/javascript"></script>
- <!-- <script src="../../web/js/bootstrap-timepicker.min.js" type="text/javascript"></script> -->
- <script src="../../web/js/bootstrap-multiselect.js" type="text/javascript"></script>
- <script src="chrome://creorga/content/js/navigation.js" type="text/javascript"></script>
- <script src="chrome://creorga/content/js/preferences.js" type="text/javascript"></script>
- <script src="chrome://creorga/content/js/system.js" type="text/javascript"></script>
- <script src="chrome://creorga/content/js/database.js" type="text/javascript"></script>
- <script src="../../web/js/labels.js" type="text/javascript"></script>
- <script src="js/accountingyear.js" type="text/javascript"></script>
- <script src="../../web/js/creorga.js" type="text/javascript"></script>
-
-</body>
-</html>
+++ /dev/null
-
-<!DOCTYPE html>
-
-<html lang="fr">
-<head>
- <meta charset="utf-8">
- <title>Décompte</title>
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <meta http-equiv="cache-control" content="max-age=0" />
- <meta http-equiv="cache-control" content="no-cache" />
- <meta http-equiv="expires" content="0" />
- <meta http-equiv="expires" content="Tue, 01 Jan 1970 1:00:00 GMT" />
- <meta http-equiv="pragma" content="no-cache" />
- <link href="../../web/css/bootstrap.min.css" rel="stylesheet" type="text/css">
- <!--<link href="../../web/css/bootstrap-theme.min.css" rel="stylesheet" type="text/css">-->
- <link href="../../web/css/datatables.min.css" rel="stylesheet" type="text/css">
- <link href="../../web/css/dataTables.bootstrap.min.css" rel="stylesheet" type="text/css">
- <link href="../../web/css/bootstrap-datetimepicker.min.css" rel="stylesheet" type="text/css">
- <!-- <link href="../../web/css/bootstrap-timepicker.min.css" rel="stylesheet" type="text/css"> -->
- <link href="../../web/css/bootstrap-multiselect.css" rel="stylesheet" type="text/css">
- <link href="../../web/css/glyphicons.css" rel="stylesheet" type="text/css">
- <link href="../../web/css/creorga.css" rel="stylesheet" type="text/css">
- <style type="text/css">
- .dataTables_filter {
- margin-top: -30px;
- }
- </style>
-</head>
-
-<body>
- <div class="container-fluid" style="padding-top: 5px;">
- <div class="row">
- <div class="col-sm-6">
- <div class="panel panel-default">
- <div class="panel-heading">
- <h3 class="panel-title"> Fichiers PDF <span style="font-weight: bold;">(requis pour import)</span></h3>
- </div>
- <div class="panel-body" id="infopanelpdf">
- <div class="form-group">
- <label for="importfileinvoice">Fichier PDF:</label>
- <input type="text" class="form-control" id="importfileinvoice" readonly="1">
- <button class="btn btn-primary" id="btnselectpdf" onclick="loadinvoicepdf();">Charger fichier PDF</button>
- <!--<label for="importtype">Type:</label>
- <select class="formcontrol" id="importtype">
- <option value="inv">Factures Check-Service</option>
- <option value="stmt">Prestations Check-Service</option>
- <option value="invold">Anciennes Factures Check-Service</option>
- </select>-->
-
- </div>
-
-
- </div>
- </div>
-
- </div>
- <div class="col-sm-6">
- <div class="panel panel-default">
- <div class="panel-heading">
- <h3 class="panel-title"> Fichier XML <span style="font-weight: bold;">(optionel pour import)</span></h3>
- </div>
- <div class="panel-body" id="infopanelxml">
- <div class="form-group">
- <label for="importfilexml">Fichier XML:</label>
- <input type="text" class="form-control" id="importfilexml" readonly="1">
- <button class="btn btn-primary" id="btnselectxml" onclick="loadinvoicexml();">Charger fichier XML</button>
-
-
- </div>
-
-
- </div>
- </div>
-
- </div>
- <div class="col-md-12">
- <button class="btn btn-primary" id="btnimportfiles" onclick="importfiles();">Importer</button>
- </div>
- <div class="col-md-12" style="text-align: center;display: none;" id="importprogress">
- <p style="font-weight: bold;">Attendez s.v.p.! Import des fichiers en cours!</p>
- <progress style="width:50%;"></progress>
- </div>
- <div class="col-md-12" style="display: none;" id="importresult">
- <table class="display compact dataTable cell-border" style="width: 100%;" id="tbl_importresult" role="grid">
- <thead><tr><th>Reference</th><th>No Check-Service</th><th>Status d'import<th></tr></thead>
- <tbody></tbody>
- </table>
- </div>
- </div>
-
- </div>
-
- <script src="../../web/js/jquery.min.js" type="text/javascript"></script>
- <script src="../../web/js/bootstrap.min.js" type="text/javascript"></script>
- <script src="../../web/js/datatables.min.js" type="text/javascript"></script>
- <script src="../../web/js/moment-with-locales.js" type="text/javascript"></script>
- <script src="../../web/js/bootstrap-datetimepicker.min.js" type="text/javascript"></script>
- <!-- <script src="../../web/js/bootstrap-timepicker.min.js" type="text/javascript"></script> -->
- <script src="../../web/js/bootstrap-multiselect.js" type="text/javascript"></script>
- <script src="chrome://creorga/content/js/navigation.js" type="text/javascript"></script>
- <script src="chrome://creorga/content/js/preferences.js" type="text/javascript"></script>
- <script src="chrome://creorga/content/js/system.js" type="text/javascript"></script>
- <script src="chrome://creorga/content/js/database.js" type="text/javascript"></script>
-
- <script src="../../web/js/labels.js" type="text/javascript"></script>
- <script src="js/checkservice.js" type="text/javascript"></script>
- <script src="../../web/js/creorga.js" type="text/javascript"></script>
-
-</body>
-</html>
+++ /dev/null
-//Source-code licensed under EUPL v1.1 ( Copyright 2016 By DKS s.à r.l. - Kilian Saffran - Luxembourg )
-
-var pconfig = {};
-var cdate = null;
-var initdate = new Date();
-initdate.setDate(1);
-var winh= window.innerHeight -140;
-var tblacc = null;
-var curchilduuid = '';
-var crecheuuid = null;
-var ccreche = null
-var importpath = null;
-var cweeks = new Array();
-var delacc = {};
-var numchilds = 0;
-var strminweek = null;
-var monthmin = null;
-var monthmax = null;
-var mpdffile = null;
-var aax = ['mon','tue','wed','thu','fri','sat'];
-//var lictype = apppref.getpreference("support.lictype");
-var amonth = ['','Janvier','Février','Mars','Avril','Mai','Juin','Juillet','Aôut','Septembre','Octobre','Novembre','Décembre'];
-function initdata(){
- curcfg.loadconfig(apppref.getpreference("support.database.currentdb.num"));
- load_helpers();
- var configdata = apppref.getpreference("pageconfig.accounting");
-
- if (configdata != '') {
- pconfig = JSON.parse(configdata);
- }
-
- if (!pconfig.printlayout) {
- pconfig.printlayout = 'list';
- apppref.setpreference("pageconfig.accounting",pconfig);
- }
- ccreche = appdb.dbquery("select uuid,idcheckservice from creche LIMIT 1;");
- crecheuuid = ccreche.sqldata[0].uuid;
- importpath = FileUtils.File(curcfg.path.local + system.sep() +"imports" + system.sep() + crecheuuid);
-
- if (pconfig.accmonth) {
-
- initdate = new Date(encodeparam(pconfig.accmonth, 'month').replace(/'/g, ''));
- $("#accmonth").val(pconfig.accmonth);
- }else {
- $("#accmonth").val(initdate.toLocaleFormat('%m.%Y'));
- pconfig.accmonth=initdate.toLocaleFormat('%m.%Y');
- }
- cdate = initdate.toLocaleFormat('%Y-%m-%d');
- var cmonth = initdate.getMonth() +1;
- mpdffile = system.getDirectory(appdb.dbFile.path) + system.sep() + 'imports' + system.sep() + crecheuuid +system.sep() + initdate.getFullYear() + "." + cmonth + ".pdf";
- if (system.fileexists(mpdffile)){
- $("#monthlypdf").show();
- }
- //lictype = apppref.getpreference("support.lictype");
- //if (lictype != 'free'){
- // $("#invoicefile").removeAttr("disabled");
- // $("#mnuacc").css({"position":"absolute","z-index":"1000"});
- //}
- set_infoheader(amonth[parseInt(pconfig.accmonth.substring(0,2))] + " " + pconfig.accmonth.substring(3,8));
- load_accounting_table();
- var bfile = appdb.dbquery("select benefitfile from accounting where accmonth = date('"+pconfig.accmonth+"') group by benefitfile LIMIT 1;");
- if (bfile.sqldata.length == 1) {
- $('#mnuacc').append("<button type=\"button\" class=\"btn btn-primary\" onclick=\"openfile('"+ bfile.sqldata[0].benefitfile +"');\" title=\"editer\"><span class=\"glyphicon glyphicon-open\"></span> fichier des prestations</button>");
- }
- $("#accmonth").on("dp.hide", function (e) {
- set_accmonth();
- });
- //load_column_selection();
-}
-
-function load_accounting_table(){
- //dump("accounting:" + JSON.stringify(pconfig) + "\n");
- var accyear = pconfig.accmonth.substring(3,7);
- //dump("accyear:" + accyear + "\n");
- var daterangesql = "select case when strftime('%Y',date(yeardaybegin)) == '"+accyear+"' then yeardaybegin else strftime('%Y-%m-%d',date(date(yeardaybegin),'+7 days')) end as yeardaybegin,"+
- "strftime('%Y-%m-%d',date(date(yeardayend),'+6 days')) as yeardayend "+
- "from ( " +
- "select case when strftime('%w','"+accyear+"-01-01') = '1' then strftime('%Y-%m-%d','"+accyear+"-01-01') else strftime('%Y-%m-%d', date(date('"+accyear+"-01-01','-7 days'),'weekday 1')) end as yeardaybegin, "+
- "case when strftime('%w','"+accyear+"-12-31') = '1' then strftime('%Y-%m-%d','"+accyear+"-12-31') else strftime('%Y-%m-%d', date(date('"+accyear+"-12-31','-7 days'),'weekday 1')) end as yeardayend "+
- ");";
- var daterange = appdb.dbquery(daterangesql);
- daterange = daterange.sqldata[0];
- var yearmin = daterange.yeardaybegin;
- var yearmax = daterange.yeardayend;
-
- var weekssql =
- "select *,'Semaine ' || strftime('%W %Y',week1begin) || '<br/>' || strftime('%d.%m.%Y',week1begin) || '<br/>' || strftime('%d.%m.%Y',week1end) as week1str, "+
-"'Semaine ' || strftime('%W %Y',week2begin) || '<br/>' || strftime('%d.%m.%Y',week2begin) || '<br/>' || strftime('%d.%m.%Y',week2end) as week2str, "+
-"'Semaine ' || strftime('%W %Y',week3begin) || '<br/>' || strftime('%d.%m.%Y',week3begin) || '<br/>' || strftime('%d.%m.%Y',week3end) as week3str, "+
-"'Semaine ' || strftime('%W %Y',week4begin) || '<br/>' || strftime('%d.%m.%Y',week4begin) || '<br/>' || strftime('%d.%m.%Y',week4end) as week4str, "+
-"'Semaine ' || strftime('%W %Y',week5begin) || '<br/>' || strftime('%d.%m.%Y',week5begin) || '<br/>' || strftime('%d.%m.%Y',week5end) as week5str, "+
-"'Semaine ' || strftime('%W %Y',week6begin) || '<br/>' || strftime('%d.%m.%Y',week6begin) || '<br/>' || strftime('%d.%m.%Y',week6end) as week6str, "+
- "printf(\"%02d\",strftime('%W',week1begin)) as cwweek1, " +
- "printf(\"%02d\",strftime('%W',week2begin)) as cwweek2, " +
- "printf(\"%02d\",strftime('%W',week3begin)) as cwweek3, " +
- "printf(\"%02d\",strftime('%W',week4begin)) as cwweek4, " +
- "printf(\"%02d\",strftime('%W',week5begin)) as cwweek5, " +
- "printf(\"%02d\",strftime('%W',week6begin)) as cwweek6 " +
-"from (" +
- "select case when week1 >= '" + cdate + "' and week1 <= date('" + cdate + "','+1 month','-1 day') then week1 else null end as week1begin," +
- "case when week1 >= '" + cdate + "' and week1 <= date('" + cdate + "','+1 month','-1 day') then date(week1,'+5 days') else null end as week1end," +
- "case when week2 >= '" + cdate + "' and week2 <= date('" + cdate + "','+1 month','-1 day') then week2 else null end as week2begin," +
- "case when week2 >= '" + cdate + "' and week2 <= date('" + cdate + "','+1 month','-1 day') then date(week2,'+5 days') else null end as week2end," +
- "case when week3 >= '" + cdate + "' and week3 <= date('" + cdate + "','+1 month','-1 day') then week3 else null end as week3begin," +
- "case when week3 >= '" + cdate + "' and week3 <= date('" + cdate + "','+1 month','-1 day') then date(week3,'+5 days') else null end as week3end," +
- "case when week4 >= '" + cdate + "' and week4 <= date('" + cdate + "','+1 month','-1 day') then week4 else week4 end as week4begin," +
- "case when week4 >= '" + cdate + "' and week4 <= date('" + cdate + "','+1 month','-1 day') then date(week4,'+5 days') else null end as week4end," +
- "case when week5 >= '" + cdate + "' and week5 <= date('" + cdate + "','+1 month','-1 day') then week5 else null end as week5begin," +
- "case when week5 >= '" + cdate + "' and week5 <= date('" + cdate + "','+1 month','-1 day') then date(week5,'+5 days') else null end as week5end, " +
- "case when week6 >= '" + cdate + "' and week6 <= date('" + cdate + "','+1 month','-1 day') then week6 else null end as week6begin," +
- "case when week6 >= '" + cdate + "' and week6 <= date('" + cdate + "','+1 month','-1 day') then date(week6,'+5 days') else null end as week6end " +
-"from (select weekdaybegin as week1, date(weekdaybegin,'+7 days') as week2, date(weekdaybegin,'+14 days') as week3, date(weekdaybegin,'+21 days') as week4, date(weekdaybegin,'+28 days') as week5, date(weekdaybegin,'+35 days') as week6 from (select case when strftime('%w','" + cdate + "') = '1' then strftime('%Y-%m-%d','" + cdate + "') else strftime('%Y-%m-%d', date(date('" + cdate + "','-7 days'),'weekday 1')) end as weekdaybegin)))";
-
- cweeks = new Array();
-
- var weeks = appdb.dbquery(weekssql);
- weeks = weeks.sqldata[0];
-
-
- for (var w = 1; w < 7; w++) {
-
- if ((weeks["week" + w + "begin"]) && (weeks["week" + w + "begin"] != '')){
-
- var obj = {cw:weeks["cwweek" + w],weekbegin:weeks["week" +w + "begin"],weekend:weeks["week" +w + "end"],weekheader:weeks["week" +w + "str"]};
- cweeks.push(obj);
- }
- }
- strminweek = cweeks[0].cw;
- monthmin = cweeks[0].weekbegin;
- monthmax = cweeks[cweeks.length-1].weekend;
- aax = ['','mon','tue','wed','thu','fri','sat'];
- // || ' (' || weekhourcosts || '€/h)' -- || ' (' || weeklunchcosts || '€/déj.)'+
-// var accsql = "select planned.uuid as childuuid, planned.clientnumber as clientnumber, planned.checkservicenumber as checkservicenumber, COALESCE( planned.prename, '' ) || ' ' || COALESCE( planned.surname, '' ) AS childname, '' as presencedetails, '' as planneddetails,replace(acc.reference,'NOCHECKSERVICE:','<span style=\"color: red;\">(facture non check-service)</span><br/>') as reference, " +
-// "case when acc.invoiceamount is not null then printf(\"%.2f\",COALESCE(acc.invoiceamount,0.00)) || '€' || case when acc.invoicedate is not null then '<br/>(' || strftime('%d.%m.%Y',acc.invoicedate) || ')' || CASE WHEN acc.reminderdate1 IS NOT NULL THEN '<br/>R1:' || strftime('%d.%m.%Y',acc.reminderdate1) ELSE '' END || CASE WHEN acc.reminderdate2 IS NOT NULL THEN '<br/>R2:' || strftime('%d.%m.%Y',acc.reminderdate2) ELSE '' END || CASE WHEN acc.reminderdate3 IS NOT NULL THEN '<br/>R3:' || strftime('%d.%m.%Y',acc.reminderdate3) ELSE '' END else '' end else '' end as invoiced, " +
-// "case when acc.payedamount is not null then printf(\"%.2f\",COALESCE(acc.payedamount,0.00)) || '€' || case when acc.payeddate is not null then '<br/>(' || strftime('%d.%m.%Y',acc.payeddate) || ')' else '' end else '' end as payement," +
-// "'' as benefitamount," +
-// "'<button type=\"button\" class=\"btn btn-primary\" onclick=\"dlg_accounting(''' || acc.uuid || ''');\" title=\"editer\"><span class=\"glyphicon glyphicon-pencil\"></span></button>' || CASE WHEN acc.invoicefile IS NOT NULL and acc.invoicefile != '' THEN '<button type=\"button\" class=\"btn btn-primary\" onclick=\"openfile(''' || acc.invoicefile || ''');\" title=\"editer\"><span class=\"glyphicon glyphicon-open\"></span>' else '' end || CASE WHEN acc.childuuid IS NOT NULL AND acc.accmonth IS NOT NULL THEN '<button type=\"button\" class=\"btn btn-danger\" onclick=\" confirm_delete_accounting(''' || acc.uuid || ''');\" title=\"supprimer\"><span class=\"glyphicon glyphicon-remove\"></span></button>' ELSE '' END AS act " +
-// " from accounting acc join childs planned on (acc.childuuid=planned.uuid) WHERE acc.accmonth='"+ initdate.toLocaleFormat("%Y-%m-%d")+ "' and acc.reference LIKE 'NOCHECKSERVICE:%' "
-
-// accsql += "UNION select planned.childuuid,planned.clientnumber,planned.checkservicenumber,planned.childname,d1.weekdetails as presencedetails,planned.planneddetails,d1.reference,d1.invoiced,d1.payement,d1.benefitamount,d1.act from ( " +
-// "select childuuid,group_concat( '<span class=\"glyphicon glyphicon-calendar\"></span>:' || pcalweek || ' <span class=\"glyphicon glyphicon-time\"></span>: ' || weekplantime , '<br/>' ) as planneddetails,clientnumber,childname,checkservicenumber from ("+
-// "select pcalweek,childuuid,sum(monplantime) + sum(tueplantime) + sum(wedplantime) + sum(thuplantime) + sum(friplantime), sum(satplantime) as weekplantime,clientnumber,childname,checkservicenumber from ("+
-// "select strftime(\"%W\",dd.daydate) as pcalweek, dd.daydate, ch.uuid as childuuid, ch.clientnumber, ch.prename || ' ' || ch.surname as childname, ch.checkservicenumber,";
-// for (var d4 in aax){
-// var dw4 = d4;dw4++;
-// accsql += "case when strftime(\"%w\",dd.daydate) = '"+ dw4+"' then cast( ( strftime( \"%s\", "+ aax[d4]+"timeend )- strftime( \"%s\", "+ aax[d4]+"timebegin ) )/ 3600.0 AS REAL )+ case when "+ aax[d4]+"timebegin2 is not null then CAST( ( strftime( \"%s\", "+ aax[d4]+"timeend2 )- strftime( \"%s\", "+ aax[d4]+"timebegin2 ) )/ 3600.0 AS REAL ) else 0.0 end else 0.00 end as "+ aax[d4]+"plantime,";
-// }
-// accsql += " null as nouse from childs ch join planning pl on ( ch.uuid = pl.childuuid ) JOIN( " ;
-// accsql += getdaterangesql(monthmin,monthmax);
-// accsql += ") dd on ( dd.daydate BETWEEN pl.datebegin AND pl.dateend ) ) group by childuuid,pcalweek ) group by childuuid) planned ";
-// accsql += "left join ( " +
-// "select clientnumber,checkservicenumber,childname,childuuid,group_concat( '<span class=\"glyphicon glyphicon-calendar\"></span>:' || calweek || ' <span class=\"glyphicon glyphicon-time\"></span>: ' || durationweek || ' h <span class=\"glyphicon glyphicon-cutlery\"></span>: ' || lunchweek ,'<br/>') as weekdetails, " +
-// //"printf(\"%.2f\",sum(weektotalhourcosts)) as monthtotalhourcosts, printf(\"%.2f\",sum(weektotallunchcosts)) as monthtotallunchcosts, printf(\"%.2f\",sum(weektotalhourcosts + weektotallunchcosts)) as monthtotalcosts," +
-// "invoiced,payement,benefitamount,reference, act from (SELECT childname, checkservicenumber, clientnumber,ttl.childuuid, printf(\"%02d\",calweek) as calweek, printf(\"%.2f\",sumdurationcalweek) AS durationweek, sumlunchcalweek as lunchweek, " +
-// //"printf(\"%.2f\",weekhourcosts) as weekhourcosts, printf(\"%.2f\",weeklunchcosts) as weeklunchcosts, " +
-// //"sumdurationcalweek * weekhourcosts as weektotalhourcosts, sumlunchcalweek * weeklunchcosts as weektotallunchcosts, " +
-// "case when acc.invoiceamount is not null then printf(\"%.2f\",COALESCE(acc.invoiceamount,0.00)) || '€' || case when acc.invoicedate is not null then '<br/>(' || strftime('%d.%m.%Y',acc.invoicedate) || ')' || CASE WHEN acc.reminderdate1 IS NOT NULL THEN '<br/>R1:' || strftime('%d.%m.%Y',acc.reminderdate1) ELSE '' END || CASE WHEN acc.reminderdate2 IS NOT NULL THEN '<br/>R2:' || strftime('%d.%m.%Y',acc.reminderdate2) ELSE '' END || CASE WHEN acc.reminderdate3 IS NOT NULL THEN '<br/>R3:' || strftime('%d.%m.%Y',acc.reminderdate3) ELSE '' END else '' end else '' end as invoiced,replace(acc.reference,'NOCHECKSERVICE:','<span style=\"color: red\">(facture non check-service)</span><br/>') as reference, " +
-// "case when acc.payedamount is not null then printf(\"%.2f\",COALESCE(acc.payedamount,0.00)) || '€' || case when acc.payeddate is not null then '<br/>(' || strftime('%d.%m.%Y',acc.payeddate) || ')' else '' end else '' end as payement," +
-// "case when acc.benefitamount is not null then printf(\"%.2f\",COALESCE(acc.benefitamount,0.00)) || '€' else '' end as benefitamount," +
-// " '<button type=\"button\" class=\"btn btn-primary\" onclick=\"dlg_accounting(''' || acc.uuid || ''');\" title=\"editer\"><span class=\"glyphicon glyphicon-pencil\"></span></button>' || CASE WHEN acc.invoicefile IS NOT NULL and acc.invoicefile != '' THEN '<button type=\"button\" class=\"btn btn-primary\" onclick=\"openfile(''' || acc.invoicefile || ''');\" title=\"editer\"><span class=\"glyphicon glyphicon-open\"></span>' else '' end || CASE WHEN acc.childuuid IS NOT NULL AND acc.accmonth IS NOT NULL THEN '<button type=\"button\" class=\"btn btn-primary\" onclick=\" confirm_delete_accounting(''' || acc.uuid || ''');\" title=\"supprimer\"><span class=\"glyphicon glyphicon-remove\"></span></button>' ELSE '' END AS act " +
-// "FROM ( SELECT pch.childname, pch.checkservicenumber, pch.clientnumber, pch.childuuid, px.calweek, px.sumdurationcalweek, px.sumlunchcalweek " +
-// //"CASE WHEN px.sumdurationcalweek IS NOT NULL AND pch.checkservicenumber IS NOT NULL THEN ( SELECT coalesce(wc0.costsperhour,0.00) FROM costs wc0 WHERE wc0.startdate < date('"+yearmin+"','+' || caldays || ' days') and wc0.weeklyhourslimit <= px.sumdurationcalweek ORDER BY wc0.startdate DESC,wc0.weeklyhourslimit DESC LIMIT 1 ) WHEN px.sumdurationcalweek IS NOT NULL AND pch.checkservicenumber IS NULL THEN ( SELECT coalesce(wc0.costperhourfallback,0.00) FROM costs wc0 WHERE wc0.startdate < date('"+yearmin+"','+' || caldays || ' days') and wc0.weeklyhourslimit <= px.sumdurationcalweek ORDER BY wc0.startdate DESC,wc0.weeklyhourslimit DESC LIMIT 1 ) ELSE NULL END AS weekhourcosts,"+
-// //"CASE WHEN px.sumlunchcalweek IS NOT NULL THEN ( SELECT coalesce(wc0.dailylunchcosts,0.00) FROM costs wc0 WHERE wc0.startdate < date('"+yearmin+"','+' || caldays || ' days') and wc0.weeklyhourslimit <= px.sumdurationcalweek ORDER BY wc0.startdate DESC,wc0.weeklyhourslimit DESC LIMIT 1) ELSE NULL END AS weeklunchcosts " +
-// "FROM ( SELECT COALESCE(ch.prename,'') || ' ' || COALESCE(ch.surname,'') AS childname,ch.uuid AS childuuid,ch.clientnumber,ch.checkservicenumber " +
-// "FROM childs ch JOIN planning pl ON ( ch.uuid=pl.childuuid) " +
-// "WHERE " +
-// "(( pl.datebegin <= DATE('"+monthmin+"') AND pl.dateend >= DATE('"+monthmax+"')) OR pl.datebegin BETWEEN '"+monthmin+"' AND '"+monthmax+"' OR pl.dateend BETWEEN '"+monthmin+"' AND '"+monthmax+"')) pch " +
-// "LEFT JOIN ( "+
-// "SELECT childuuid,calweek,case when strftime('%w',date(calyear ||'-01-01')) in ('1','2','3','4') then (cast(calweek as int)*7)-7 else (cast(calweek as int)*7) end as caldays ,"+
-// "sumlunchcalweek, coalesce(sum(monduration + tueduration + wedduration + thuduration + friduration),0.0) as sumdurationcalweek " +
-// "FROM ( SELECT childuuid, daydate,calyear, case when strftime('%w',date(calyear ||'-01-01')) in ('1','2','3','4') then case when calweek < '10' then '0' else '' end || cast(calweek as int) else calweek end as calweek," +
-// "max(monlunch) + max(tuelunch) + max(wedlunch) + max(thulunch) + max(frilunch) , max(satlunch) AS sumlunchcalweek, " +
-// "MAX(monduration) + MAX(monduration2) AS monduration, " +
-// "MAX(tueduration) + MAX(tueduration2) AS tueduration, " +
-// "MAX(wedduration) + MAX(wedduration2) AS wedduration, " +
-// "MAX(thuduration) + MAX(thuduration2) AS thuduration, " +
-// "MAX(friduration) + MAX(friduration2) AS friduration, " +
-// "MAX(satduration) + MAX(satduration2) AS satduration " +
-// "FROM ( "+
-// "SELECT childuuid, daydate, strftime('%Y',daydate) as calyear," +
-// "case when strftime('%w',daydate)='0' then strftime('%W',date(daydate,'-6 days')) else strftime('%W',date(date(daydate),'-' || strftime('%w',date(daydate)) || ' days','+1 day')) end as calweek, ";
-
-// for (var d1 in aax){
-// var dw = d1;dw++;
-// accsql += "CASE WHEN lunch=1 AND status IN (1,5) AND strftime('%w',daydate) = '"+dw+"' THEN 1 ELSE 0 END AS "+aax[d1]+"lunch,";
-// }
-
-// for (var d2 in aax){
-// var dw2 = d2;dw2++;
-// accsql += "CASE WHEN xx.status IS NOT NULL AND strftime('%w',xx.daydate) = '"+dw2+"' AND xx.daydate BETWEEN xx.datebegin AND xx.dateend THEN CAST(( (( CAST(SUBSTR(xx."+ aax[d2]+"timeend,1,2) AS INT) *3600)+( CAST(SUBSTR(xx."+ aax[d2]+"timeend,4,2) AS INT) *60))- ((CAST(SUBSTR(xx."+ aax[d2]+"timebegin,1,2) AS INT) *3600)+( CAST(SUBSTR(xx."+ aax[d2]+"timebegin,4,2) AS INT) *60)) ) / 3600 AS REAL) ELSE 0.0 END AS "+ aax[d2]+"duration,";
-// }
-
-
-// for (var d3 in aax){
-// var dw3 = d3;dw3++;
-// accsql += "CASE WHEN xx.status IS NOT NULL AND strftime('%w',xx.daydate) = '1' AND xx.daydate BETWEEN xx.datebegin AND xx.dateend AND xx."+ aax[d3]+"timebegin2 IS NOT NULL AND xx."+ aax[d3]+"timeend2 IS NOT NULL THEN CAST(( (( CAST(SUBSTR(xx."+ aax[d3]+"timeend2,1,2) AS INT) *3600)+( CAST(SUBSTR(xx."+ aax[d3]+"timeend2,4,2) AS INT) *60))- ((CAST(SUBSTR(xx."+ aax[d3]+"timebegin2,1,2) AS INT) *3600)+( CAST(SUBSTR(xx."+ aax[d3]+"timebegin2,4,2) AS INT) *60)) ) / 3600 AS REAL) ELSE 0.0 END AS "+ aax[d3]+"duration2,";
-// }
-
-// accsql += "null as nouse FROM (" +
-// " select vacancydate as daydate, CAST('0' as boolean) as lunch,1 as status,pl.* from vacancy va " +
-// " left join planning pl on (va.vacancydate between pl.datebegin and pl.dateend) " +
-// " where va.vacancydateto is null and va.vacancydate BETWEEN '"+monthmin+"' AND '"+monthmax+"' AND strftime('%w',va.vacancydate) not in ('0') " +
-// " group by va.vacancydate,pl.childuuid " +
-// " union " +
-// " select pr.daydate,pr.lunch,pr.status,pl.* FROM presence pr " +
-// " JOIN planning pl ON ( pr.childuuid=pl.childuuid) WHERE pr.daydate BETWEEN '"+monthmin+"' AND '"+monthmax+"' "+
-// ") xx " +
-// "WHERE xx.daydate BETWEEN '"+monthmin+"' AND '"+monthmax+"') GROUP BY childuuid,calweek) GROUP BY childuuid,calweek) px " +
-// "ON ( pch.childuuid=px.childuuid) GROUP BY pch.childuuid,px.calweek ) ttl " +
-// "LEFT JOIN accounting acc ON ( ttl.childuuid = acc.childuuid AND acc.accmonth='"+ initdate.toLocaleFormat("%Y-%m-%d")+ "' where calweek is not null) group by childuuid) d1 ";
-// accsql += " on (planned.childuuid=d1.childuuid) order by planned.childname;";
-/* READY TO INSERT: */
-accsql = 'select plx.childuuid, plx.clientnumber, plx.checkservicenumber, plx.childname, plx.planneddetails,acc.invoiced, acc.reference, acc.payement, acc.benefitamount, acc.act,prd.presencedetails ' +
-'from ( select childuuid, group_concat( \'<span class="glyphicon glyphicon-calendar"></span>:\' || pcalweek || \' <span class="glyphicon glyphicon-time"></span>: \' || weekplantime , \'<br/>\' ) as planneddetails, clientnumber, childname, checkservicenumber from (' +
-'select pcalweek, childuuid, coalesce(sum(monplantime),0.00) + coalesce(sum(tueplantime),0.00) + coalesce(sum(wedplantime),0.00) + coalesce(sum(thuplantime),0.00) + coalesce(sum(friplantime),0.00) +coalesce(sum(satplantime),0.00) as weekplantime, clientnumber, childname, checkservicenumber ' +
- 'from ( select strftime("%W", dd.daydate) as pcalweek, strftime("%w", dd.daydate) as weekday, dd.daydate, ch.uuid as childuuid, ch.clientnumber, ch.prename || \' \' || ch.surname as childname, ch.checkservicenumber, ';
-for (var i=1;i<aax.length;i++){
- accsql += "case when strftime(\"%w\", dd.daydate) = '"+ i +"' then cast( ( strftime( \"%s\", "+aax[i]+"timeend )- strftime( \"%s\", "+aax[i]+"timebegin ) )/ 3600.0 AS REAL )+ case when "+aax[i]+"timebegin2 is not null then CAST( ( strftime( \"%s\", "+aax[i]+"timeend2 )- strftime( \"%s\", "+aax[i]+"timebegin2 ) )/ 3600.0 AS REAL ) else 0.0 end else 0.00 end as "+aax[i]+"plantime, ";
-}
- accsql += 'null as nouse ' +
- 'from planning pl left join childs ch on ( pl.childuuid = ch.uuid) JOIN( ' ;
- accsql += getdaterangesql(monthmin,monthmax);
-accsql += ') dd on ( dd.daydate BETWEEN pl.datebegin AND pl.dateend ) group by datebegin,dateend,childuuid,daydate ) group by pcalweek,childuuid ) planned group by childuuid ) plx ';
-accsql += " left join ( select a2.childuuid, a2.nocheckservice," +
- "coalesce(printf(\"%.2f €\",a2.invoiceamount), 0.00) || coalesce (strftime('<br/> %d.%m.%Y', a2.invoicedate),'') || coalesce(', R1: ' || strftime('%d.%m.%Y', a2.reminderdate1),'') || coalesce(', R2: ' || strftime('%d.%m.%Y', a2.reminderdate2),'') || coalesce(', R3: ' || strftime('%d.%m.%Y', a2.reminderdate3),'') as invoiced, a2.reference, "+
- "coalesce(printf(\"%.2f €\",a2.payedamount), 0.00) || coalesce (strftime('<br/> %d.%m.%Y', a2.payeddate),'') as payement,"+
- "coalesce(printf(\"%.2f €\",a2.benefitamount), 0.00) as benefitamount," +
- "'<button type=\"button\" class=\"btn btn-primary\" onclick=\"dlg_accounting(''' || a2.uuid || ''');\" title=\"editer\"><span class=\"glyphicon glyphicon-pencil\"></span></button>' || CASE WHEN a2.invoicefile IS NOT NULL and a2.invoicefile != '' THEN '<button type=\"button\" class=\"btn btn-primary\" onclick=\"openfile(''' || a2.invoicefile || ''');\" title=\"editer\"><span class=\"glyphicon glyphicon-open\"></span>' else '' end || "+
- "CASE WHEN a2.childuuid IS NOT NULL AND a2.accmonth IS NOT NULL THEN '<button type=\"button\" class=\"btn btn-primary\" onclick=\" confirm_delete_accounting(''' || a2.uuid || ''');title=\"supprimer\"><span class=\"glyphicon glyphicon-remove\"></span></button>' " +
- " ELSE '' END AS act from accounting a2 " +
- " where a2.accmonth = '"+ initdate.toISOString().substring(0,10)+"' ) acc on (plx.childuuid=acc.childuuid) left join (" +
-"select childuuid, group_concat( '<span class=\"glyphicon glyphicon-calendar\"></span>:' || calweek || ' <span class=\"glyphicon glyphicon-time\"></span>: ' || weekduration || ' <span class=\"glyphicon glyphicon-cuterly\"></span>: ' || weeklunch,'<br/>') as presencedetails from ( "+
-"select childuuid, calweek, monlunch + tuelunch + wedlunch + thulunch + frilunch + satlunch as weeklunch, "+
-"monduration + tueduration + wedduration + thuduration + friduration + satduration + monduration2 + tueduration2 + wedduration2 + thuduration2 + friduration2 + satduration2 as weekduration " +
-" from ( " + "select childuuid,daydate,strftime('%Y', daydate) as calyear, " +
- "case when strftime('%w', daydate)= '0' then strftime('%W', date(daydate, '-6 days')) else strftime('%W', date(date(daydate), '-' || strftime('%w', date(daydate)) || ' days', '+1 day')) end as calweek, ";
- for (var i=1;i<aax.length;i++){
- accsql += "CASE WHEN lunch = 1 AND status IN (1, 5) AND strftime('%w', daydate) = '"+ i +"' THEN 1 ELSE 0 END AS "+ aax[i]+"lunch, ";
- }
- for (var i=1;i<aax.length;i++){
- accsql += "CASE WHEN status IS NOT NULL AND strftime('%w', daydate) = '"+ i +"' THEN CAST(( (( coalesce(CAST(SUBSTR(endtime1, 1, 2) AS INT),0) * 3600)+( coalesce(CAST(SUBSTR(endtime1, 4, 2) AS INT),0) * 60))- ((coalesce(CAST(SUBSTR(begintime1, 1, 2) AS INT),0) * 3600)+( coalesce(CAST(SUBSTR(begintime1, 4, 2) AS INT),0) * 60)) ) / 3600 AS REAL) ELSE 0.0 END AS "+ aax[i]+"duration, ";
- accsql += "CASE WHEN status IS NOT NULL AND strftime('%w', daydate) = '"+ i +"' THEN CAST(( (( coalesce(CAST(SUBSTR(endtime2, 1, 2) AS INT),0) * 3600)+( coalesce(CAST(SUBSTR(endtime2, 4, 2) AS INT),0) * 60))- ((coalesce(CAST(SUBSTR(begintime2, 1, 2) AS INT),0) * 3600)+( coalesce(CAST(SUBSTR(begintime2, 4, 2) AS INT),0) * 60)) ) / 3600 AS REAL) ELSE 0.0 END AS "+ aax[i]+"duration2, ";
- }
- accsql += " null as nouse from presence where daydate between '"+monthmin+"' and '"+monthmax+"' ) prx group by calweek,childuuid ) prx2 group by childuuid ) prd on (prd.childuuid=acc.childuuid);";
-
- jsdump("ACCMONTH" + accsql);
- var accdata = appdb.dbquery(accsql);
- jsdump(accdata);
- //numchilds = accdata.sqldata.length;
- var headerdata = [];
- headerdata = getlabelswithkey("clientnumber,checkservicenumber,childname,presencedetails,planneddetails,reference,invoiced,payement,benefitamount,act");
- //monthtotalhourcosts,monthtotallunchcosts,monthtotalcosts,
- $("#tbl_accounting").html("");
- //var hrow = [];
- //hrow = headerdata;
- //var tdclass= new Array();
- var tblheader = '<tr>';
- //dump("Headerdata:" + JSON.stringify(headerdata) + "\n")
- for (var h in headerdata){
- if ((headerdata[h].keyname == 'act') && (headerdata[h].class.indexOf('action1btn') == -1)){
- headerdata[h].class +=" action1btn";
- }
- //if ((pconfig.hidden_columns) && (pconfig.hidden_columns.indexOf(headerdata[h].keyname) != -1)) {
- // if (headerdata[h].class.indexOf('colhidden') == -1) {
- // headerdata[h].class += " colhidden";
- // }
- //}else {
- headerdata[h].class.replace("colhidden","");
- //}
- tblheader += '<th class="' + headerdata[h].class +'">'+ headerdata[h].title+'</th>';
-
- }
- tblheader += '</tr>';
- //tblh0 += '</tr>';
- tblacc = null;
- //dump("\n\nTBL header: " + tblheader + "\n\n\n");
- $("#tbl_accounting").append("<thead>" + tblheader + "</thead>");
- $("#tbl_accounting").append("<tfoot>" + tblheader + "</tfoot>");
- $("#tbl_accounting").append("<tbody>");
-
- var curchld = "";
-
-
- for (var i in accdata.sqldata){
- var row = accdata.sqldata[i];
-
- var tr = '<tr>';
- tr += '<td>' + row.clientnumber + '</td>';
- tr += '<td>' + row.checkservicenumber + '</td>';
- tr += '<td>' + row.childname + '</td>';
- tr += '<td class="noprint infoweek">' + row.presencedetails + '</td>';
- tr += '<td class="noprint infoweek">' + row.planneddetails + '</td>';
- tr += '<td>' + row.reference + '</td>';
- //tr += '<td class="alignright totalwidth'+ (((pconfig.hidden_columns) && (pconfig.hidden_columns.indexOf('monthtotalhourcosts') != -1))?" noprint colhidden":"") +'">' + row.monthtotalhourcosts + '€</td>';
- //tr += '<td class="alignright totalwidth'+ (((pconfig.hidden_columns) && (pconfig.hidden_columns.indexOf('monthtotallunchcosts') != -1))?" noprint colhidden":"") +'">' + row.monthtotallunchcosts + '€</td>';
- //tr += '<td class="alignright totalwidth'+ (((pconfig.hidden_columns) && (pconfig.hidden_columns.indexOf('monthtotalcosts') != -1))?" noprint colhidden":"") +'">' + row.monthtotalcosts + '€</td>';
- tr += '<td class="alignright ">' + row.invoiced + '</td>';
- tr += '<td class="alignright ">' + row.payement + '</td>';
- tr += '<td class="alignright totalwidth ">' + row.benefitamount + '</td>';
- tr += '<td class="noprint">' + row.act + '</td></tr>';
- $("#tbl_accounting").append(tr);
-
- }
-
- $("#tbl_accounting").append("</tbody>");
-
-
- tblacc = $("#tbl_accounting").dataTable({
- "language": {
- "url": "../../web/js/locale/datatable_fr.json"
- },
- "paging": false,
- "ordering": true,
- "bAutoWidth": false,
- "scrollY": winh + "px",
- "scrollCollapse": true,
- "info": false,
- "filter": true,
- "destroy": true,
- "footerCallback": function ( row, data, start, end, display ) {
- var api = this.api(), data;
-
- var intVal = function ( i ) {
- return typeof i === 'string' ?
- i.substring(0,i.indexOf("\€"))*1 :
- typeof i === 'number' ?
- i : 0;
- };
-
- //hTotal = api
- // .column( 2, { page: 'current'} )
- // .data()
- // .reduce( function (a, b) {
- // return intVal(a) + intVal(b);
- // }, 0 );
-
- //lTotal = api
- // .column( 3, { page: 'current'} )
- // .data()
- // .reduce( function (a, b) {
- // return intVal(a) + intVal(b);
- // }, 0 );
- fTotal = api
- .column( 6, { page: 'current'} )
- .data()
- .reduce( function (a, b) {
- return intVal(a) + intVal(b);
- }, 0 );
- pTotal = api
- .column( 7, { page: 'current'} )
- .data()
- .reduce( function (a, b) {
- return intVal(a) + intVal(b);
- }, 0 );
- bTotal = api
- .column( 8, { page: 'current'} )
- .data()
- .reduce( function (a, b) {
- return intVal(a) + intVal(b);
- }, 0 );
- //pageTotal = api
- // .column( 4, { page: 'current'} )
- // .data()
- // .reduce( function (a, b) {
- // return intVal(a) + intVal(b);
- // }, 0 );
-
- // Update footer
- $( api.column( 6 ).footer() ).html(
- ''+fTotal.toFixed(2) +' €'
- );
- $( api.column( 7 ).footer() ).html(
- ''+pTotal.toFixed(2) +' €'
- );
- $( api.column( 8 ).footer() ).html(
- ''+bTotal.toFixed(2) +' €'
- );
- //$( api.column( 4 ).footer() ).html(
- // ''+pageTotal.toFixed(2) +' €'
- //);
- // $( api.column( 3 ).footer() ).html(
- // ''+lTotal.toFixed(2) +' €'
- //);
- //$( api.column( 2 ).footer() ).html(
- // ''+hTotal.toFixed(2) +' €'
- //);
- }
- });
-
-// $('#tbl_accounting').on( 'search.dt', function () {
-//
-// pconfig.filter = tblacc.api().search();
-//
-// apppref.setpreference("pageconfig.accounting",pconfig);
-// } );
-
- $('#tbl_accounting').on( 'order.dt', function () {
- pconfig.order= tblacc.fnSettings().aaSorting;
-
- apppref.setpreference("pageconfig.accounting",pconfig);
-
- } );
-
-// if (pconfig.filter) {
-// tblacc.fnFilter(pconfig.filter);
-// }
- if (pconfig.order) {
- //tblacc.fnDraw();
- tblacc.fnSort(pconfig.order);
- }
- //tblacc.fnAdjustColumnSizing();
-
-
-
-$('#tbl_accounting tbody').on( 'click', 'tr', function () {
- if ( $(this).hasClass('selected') ) {
- //$(this).removeClass('selected');
- }
- else {
- tblacc.$('tr.selected').removeClass('selected');
- $(this).addClass('selected');
- }
- } );
-
-}
-
-function getdaterangesql(xmonthmin,xmonthmax){
- var adays = [];
-
- var bdate = new Date(xmonthmin);
- var bend = new Date(xmonthmax);
- for (var cdt = bdate; cdt <= bend; cdt.setDate(cdt.getDate() + 1)) {
- if ((cdt.getDay() !== 0) ){
- adays.push("select date('" + cdt.toLocaleFormat('%Y-%m-%d') + "') as daydate");
- }
-
- }
- return adays.join(" UNION ");
- }
-
-
-function set_accmonth(){
- pconfig.accmonth = $('#accmonth').val();
-
- apppref.setpreference("pageconfig.accounting",pconfig);
- globelreq.send_request({
- page: 'accounting',
- module: 'accounting',
- data: null,
- header: 'Décompte par mois'
- });
-}
-
-function confirm_delete_accounting(duuid) {
- delacc.uuid = duuid;
- $('#confirm_delete_accounting').modal('show');
-}
-
-function delete_accounting() {
- var xsql = "DELETE FROM accounting where uuid='"+ delacc.uuid+"';";
-
- appdb.dbexec(xsql);
- load_accounting_table();
- delacc ={};
-
- $('#confirm_delete_accounting').modal('hide');
-}
-
-function dlg_accounting(myuuid){
-
- //alert("TEST");
- var acc1sql = "SELECT acc.uuid,acc.accmonth,ch.uuid as childuuid,COALESCE( ch.prename, '' ) || ' ' || COALESCE( ch.surname, '' ) || '(' || ch.checkservicenumber || ')' AS childname,case when acc.invoicedate is not null then strftime('%d.%m.%Y',acc.invoicedate) else null end as invoicedate, case when acc.payeddate is not null then strftime('%d.%m.%Y',acc.payeddate) else null end as payeddate, payedamount, invoiceamount,benefitamount, replace(acc.reference,'NOCHECKSERVICE:','') as reference, instr(acc.reference,'NOCHECKSERVICE:') as ischeckservice, case when acc.reminderdate1 is not null then strftime('%d.%m.%Y',acc.reminderdate1) else null end as reminderdate1, case when acc.reminderdate2 is not null then strftime('%d.%m.%Y',acc.reminderdate2) else null end as reminderdate2, case when acc.reminderdate3 is not null then strftime('%d.%m.%Y',acc.reminderdate3) else null end as reminderdate3, case when acc.invoicefile is not null and acc.invoicefile != '' then '"+ importpath.path + system.sep() +"' || acc.invoicefile else null end as invoicefile,'upd' as action FROM accounting acc join childs ch on (ch.uuid=acc.childuuid) where acc.uuid = '"+ myuuid+"';";
-
- //jsdump(acc1sql);
- var acc1data = appdb.dbquery(acc1sql);
-
- if (!acc1data.sqldata) {
- return false;
- //acc1sql = "SELECT '0' as uuid,'"+ childuuid+"' as childuuid, 1 as ischeckservice, null as invoicedate, null as payeddate, null as payedamount, null as invoiceamount, null as reference,null as benefitamount, null as reminderdate1, null as reminderdate2, null as reminderdate3, null as invoicefile, 'ins' as action;";
- //acc1data = appdb.dbquery(acc1sql);
- }
- acc1data = acc1data.sqldata[0];
- $("#frmeditaccounting #uuid").val(acc1data.uuid);
- if (acc1data.ischeckservice > 0){
- $("#frmeditaccounting #nocheckservice").prop("checked",true);
- } else {
- $("#frmeditaccounting #nocheckservice").prop("checked",false);
- }
- for (var a in acc1data){
-
- if ($("#frmeditaccounting #" +a)) {
-
- $("#frmeditaccounting #"+a).val(acc1data[a]);
- }
- }
- $("#edit_accounting").modal('show');
-
-}
-
-function save_accounting(){
-
- var sql2 = new Array();
- //var type = 'upd';
- // if (type == 'ins'){
- // sql1.push('"accmonth"');
- // sql2.push("'" + initdate.toLocaleFormat('%Y-%m-%d') +"'");
- // }
- $("#frmeditaccounting :input").each(function(){
- var input = $(this);
- if (input.attr("id") ){
- // if ((type == 'ins') && (input.attr("id") != 'action')) {
- // sql1.push('"' + input.attr("id") + '"');
- // if (input.attr("type") == "file") {
- // if (!system.fileexists(importpath.path)){
- // importpath.create(1,0755);
- // }
- // var newlocation= importpath.path + system.sep() + system.getFileName(input.val());
- // OS.File.copy(input.val(), newlocation);
- // }
- // var ival = encodeparam(input.val(),input.attr('type'));
- // sql2.push(ival);
- // }
- //else {
- if ((input.attr("type") != 'hidden') && (input.attr("id") != 'childname') && (input.attr("id") != 'ischeckservice')) {
- if (input.attr("type") == "file") {
- if (system.getDirectory(input.val()) != importpath.path) {
- var newlocation= importpath.path + system.sep() + system.getFileName(input.val());
- OS.File.copy(input.val(), newlocation);
- }
- }
- var ival = input.val();
- if ((input.attr("id") == 'reference') && $("#frmeditaccounting #ischeckservice").is(":checked")){
- ival = "NOCHECKSERVICE:" + ival;
- }
-
- var ival = encodeparam(ival,input.attr('type'));
- if (input.attr("id") == 'invoicedate'){
- var newaccmonth = ival.replace(/'/g,"");
- sql2.push('"accmonth"=\'' + newaccmonth.substring(0,4) + "-" + newaccmonth.substring(5,7) +"-01'");
- }
- sql2.push('"' + input.attr("id") +'"='+ ival);
-
- }
- }
- });
- var xsql = "UPDATE accounting SET "+sql2.join(',')+" where \"uuid\"='" + $("#frmeditaccounting #uuid").val() + "';";
- //}
- // else {
- // xsql = "INSERT INTO accounting ("+sql1.join(',')+") VALUES ("+sql2.join(',')+");";
- // }
-
- appdb.dbexec(xsql);
- load_accounting_table();
- $("#frmeditaccounting #uuid").val("0");
- $("#edit_accounting").modal('hide');
-}
-
-function openfile(fi){
- var ddir = system.getDirectory(appdb.dbFile.path);
- var ff = system.openFile(ddir + system.sep() + 'imports' + system.sep() + crecheuuid +system.sep() + fi);
-}
-
-function onnextmonth() {
- pconfig.accmonth = $('#accmonth').val();
-
-
- var tmpmonth = new Date(encodeparam(pconfig.accmonth, 'month').replace(/'/g, ''));
- var nmonth = new Date(tmpmonth.getFullYear(), tmpmonth.getMonth() + 1, tmpmonth.getDate());
- pconfig.accmonth = nmonth.toLocaleFormat('%m.%Y');
- apppref.setpreference("pageconfig.accounting",pconfig);
- globelreq.send_request({
- page: 'accounting',
- module: 'accounting',
- data: null,
- header: 'Décompte par mois'
- });
-}
-
-function onpreviousmonth() {
- pconfig.accmonth = $('#accmonth').val();
- var tmpmonth = new Date(encodeparam(pconfig.accmonth, 'month').replace(/'/g, ''));
- var nmonth = new Date(tmpmonth.getFullYear(), tmpmonth.getMonth() - 1, tmpmonth.getDate());
- pconfig.accmonth = nmonth.toLocaleFormat('%m.%Y');
- apppref.setpreference("pageconfig.accounting",pconfig);
- globelreq.send_request({
- page: 'accounting',
- module: 'accounting',
- data: null,
- header: 'Décompte par mois'
- });
-}
-
-function generatecsv(){
- var lastdir = '';
- if (pconfig.lastdir){
- lastdir = pconfig.lastdir;
- }
- var expfolder = system.selectdirectory(lastdir,"Sélection dossier!");
- //dump("EXPFOLDER:" + expfolder);
- if (!expfolder){
- return;
- }else {
- pconfig.lastdir = expfolder.path;
- apppref.setpreference("pageconfig.accounting",pconfig);
- }
- var val = $("#accmonth").val();
- var cdate = new Date();
- var accsql = "select planned.childuuid,planned.checkservicenumber,planned.pcalweek,replace(printf(\"%.2f\",COALESCE(planned.weekplantime,0.00)),'.',',') as weekplantime,d1.calweek,replace(printf(\"%.2f\",COALESCE(d1.durationweek,0.00)),'.',',') as durationweek,COALESCE(d1.lunchweek,0) as lunchweek from ( " +
- "select checkservicenumber || '-' || pcalweek as idjoin,childuuid,pcalweek, weekplantime,checkservicenumber from ("+
- "select pcalweek,childuuid,sum(monplantime) + sum(tueplantime) + sum(wedplantime) + sum(thuplantime) + sum(friplantime) as weekplantime,checkservicenumber from ("+
- "select strftime(\"%W\",dd.daydate) as pcalweek, dd.daydate, ch.uuid as childuuid, ch.checkservicenumber,";
- for (var d4 in aax){
- var dw4 = d4;dw4++;
- accsql += "case when strftime(\"%w\",dd.daydate) = '"+ dw4+"' then cast( ( strftime( \"%s\", "+ aax[d4]+"timeend )- strftime( \"%s\", "+ aax[d4]+"timebegin ) )/ 3600.0 AS REAL )+ case when "+ aax[d4]+"timebegin2 is not null then CAST( ( strftime( \"%s\", "+ aax[d4]+"timeend2 )- strftime( \"%s\", "+ aax[d4]+"timebegin2 ) )/ 3600.0 AS REAL ) else 0.0 end else 0.00 end as "+ aax[d4]+"plantime,";
- }
- accsql += " null as nouse from childs ch join planning pl on ( ch.uuid = pl.childuuid ) JOIN( " ;
- accsql += getdaterangesql(monthmin,monthmax);
- accsql += ") dd on ( dd.daydate BETWEEN pl.datebegin AND pl.dateend ) ) group by childuuid,pcalweek ) group by childuuid,pcalweek) planned ";
- accsql += "left join ( " +
- "select checkservicenumber || '-' || calweek as idjoin,checkservicenumber,childuuid, calweek , durationweek , lunchweek " +
- " from (SELECT checkservicenumber,ttl.childuuid,calweek, sumdurationcalweek AS durationweek, sumlunchcalweek as lunchweek " +
-
-
- "FROM ( SELECT pch.checkservicenumber, pch.childuuid, px.calweek, px.sumdurationcalweek, px.sumlunchcalweek " +
- //"CASE WHEN px.sumdurationcalweek IS NOT NULL AND pch.checkservicenumber IS NOT NULL THEN ( SELECT coalesce(wc0.costsperhour,0.00) FROM costs wc0 WHERE wc0.startdate < date('"+yearmin+"','+' ||
- "FROM ( SELECT ch.uuid AS childuuid,ch.checkservicenumber " +
- "FROM childs ch JOIN planning pl ON ( ch.uuid=pl.childuuid) " +
- "WHERE " +
- "(( pl.datebegin <= DATE('"+monthmin+"') AND pl.dateend >= DATE('"+monthmax+"')) OR pl.datebegin BETWEEN '"+monthmin+"' AND '"+monthmax+"' OR pl.dateend BETWEEN '"+monthmin+"' AND '"+monthmax+"')) pch " +
- "LEFT JOIN ( "+
- "SELECT childuuid,calweek,case when strftime('%w',date(calyear ||'-01-01')) in ('1','2','3','4') then (cast(calweek as int)*7)-7 else (cast(calweek as int)*7) end as caldays ,"+
- "sumlunchcalweek, coalesce(sum(monduration + tueduration + wedduration + thuduration + friduration),0.0) as sumdurationcalweek " +
- "FROM ( SELECT childuuid, daydate,calyear, case when strftime('%w',date(calyear ||'-01-01')) in ('1','2','3','4') then case when calweek < '10' then '0' else '' end || cast(calweek as int) else calweek end as calweek," +
- "max(monlunch) + max(tuelunch) + max(wedlunch) + max(thulunch) + max(frilunch) AS sumlunchcalweek, " +
- "MAX(monduration) + MAX(monduration2) AS monduration, " +
- "MAX(tueduration) + MAX(tueduration2) AS tueduration, " +
- "MAX(wedduration) + MAX(wedduration2) AS wedduration, " +
- "MAX(thuduration) + MAX(thuduration2) AS thuduration, " +
- "MAX(friduration) + MAX(friduration2) AS friduration " +
- "FROM ( "+
- "SELECT childuuid, daydate, strftime('%Y',daydate) as calyear," +
- "case when strftime('%w',daydate)='0' then strftime('%W',date(daydate,'-6 days')) else strftime('%W',date(date(daydate),'-' || strftime('%w',date(daydate)) || ' days','+1 day')) end as calweek, ";
-
- for (var d1 in aax){
- var dw = d1;dw++;
- accsql += "CASE WHEN lunch=1 AND status IN (1,5) AND strftime('%w',daydate) = '"+dw+"' THEN 1 ELSE 0 END AS "+aax[d1]+"lunch,";
- }
-
- for (var d2 in aax){
- var dw2 = d2;dw2++;
- accsql += "CASE WHEN xx.status IS NOT NULL AND strftime('%w',xx.daydate) = '"+dw2+"' AND xx.daydate BETWEEN xx.datebegin AND xx.dateend THEN CAST(( (( CAST(SUBSTR(xx."+ aax[d2]+"timeend,1,2) AS INT) *3600)+( CAST(SUBSTR(xx."+ aax[d2]+"timeend,4,2) AS INT) *60))- ((CAST(SUBSTR(xx."+ aax[d2]+"timebegin,1,2) AS INT) *3600)+( CAST(SUBSTR(xx."+ aax[d2]+"timebegin,4,2) AS INT) *60)) ) / 3600 AS REAL) ELSE 0.0 END AS "+ aax[d2]+"duration,";
- }
-
-
- for (var d3 in aax){
- var dw3 = d3;dw3++;
- accsql += "CASE WHEN xx.status IS NOT NULL AND strftime('%w',xx.daydate) = '1' AND xx.daydate BETWEEN xx.datebegin AND xx.dateend AND xx."+ aax[d3]+"timebegin2 IS NOT NULL AND xx."+ aax[d3]+"timeend2 IS NOT NULL THEN CAST(( (( CAST(SUBSTR(xx."+ aax[d3]+"timeend2,1,2) AS INT) *3600)+( CAST(SUBSTR(xx."+ aax[d3]+"timeend2,4,2) AS INT) *60))- ((CAST(SUBSTR(xx."+ aax[d3]+"timebegin2,1,2) AS INT) *3600)+( CAST(SUBSTR(xx."+ aax[d3]+"timebegin2,4,2) AS INT) *60)) ) / 3600 AS REAL) ELSE 0.0 END AS "+ aax[d3]+"duration2,";
- }
-
- accsql += "null as nouse FROM (" +
- " select vacancydate as daydate, CAST('0' as boolean) as lunch,1 as status,pl.* from vacancy va " +
- " left join planning pl on (va.vacancydate between pl.datebegin and pl.dateend) " +
- " where va.vacancydateto is null and va.vacancydate BETWEEN '"+monthmin+"' AND '"+monthmax+"' AND strftime('%w',va.vacancydate) not in ('0','6') " +
- " group by va.vacancydate,pl.childuuid " +
- " union " +
- " select pr.daydate,pr.lunch,pr.status,pl.* FROM presence pr " +
- " JOIN planning pl ON ( pr.childuuid=pl.childuuid) WHERE pr.daydate BETWEEN '"+monthmin+"' AND '"+monthmax+"' "+
- ") xx " +
- "WHERE xx.daydate BETWEEN '"+monthmin+"' AND '"+monthmax+"') GROUP BY childuuid,calweek) GROUP BY childuuid,calweek) px " +
- "ON ( pch.childuuid=px.childuuid) GROUP BY pch.childuuid,px.calweek ) ttl " +
- "LEFT JOIN accounting acc ON ( ttl.childuuid = acc.childuuid AND acc.accmonth='"+ initdate.toLocaleFormat("%Y-%m-%d")+ "') where calweek is not null) group by childuuid,calweek) d1 ";
- accsql += " on (d1.idjoin=planned.idjoin) order by planned.childuuid,planned.pcalweek;";
-
- dump("EXPSQL:" + accsql + "\n");
-
- var expdbdata = appdb.dbquery(accsql);
- //dump(JSON.stringify(expdbdata));
- numchilds = $("#tbl_accounting tbody tr").length -1;
- var idchkserv = ccreche.sqldata[0].idcheckservice;
- dump(JSON.stringify(cweeks) + "\n");
- var wlen = cweeks.length;
- var expdata = "E;"+ val.substring(3,7) + ";" + parseInt(val.substring(0,2)) + ";" + wlen + ";" + numchilds + ";" + cdate.toLocaleFormat('%d%m%Y') + ";;;;;;;;;;;;\r\n";
- //expdata += "P;"+ ccreche.sqldata[0].idcheckservice +";"+";;;;;;;;;;;;;;;";
- var minweek = cweeks[0].cw;
- var expchild = "";
- var cntweek = 0;
- var objrow = {};
- var allobjects = []
- for (var r in expdbdata.sqldata){
- var row = expdbdata.sqldata[r];
- if (expchild != row.childuuid){
- if (expchild != ""){
- allobjects.push(objrow);
-
- }
- objrow = new Object();
- objrow["cs"] = row.checkservicenumber;
- objrow["weeks"] = {};
- for (var w in cweeks){
- objrow["weeks"][cweeks[w].cw] = {"time":"0,00","lunch":"0"};
- }
- expchild = row.childuuid;
-// if (r != numchilds-1){
-// expdata += "P;" + idchkserv + ";" + row.checkservicenumber + ";";
-// }
- }
-
- objrow["weeks"][row.pcalweek]["time"] = ((row.durationweek == '' || row.weekplantime > row.durationweek)?row.weekplantime:row.durationweek);
- objrow["weeks"][row.pcalweek]["lunch"] = ((row.lunchweek == '')?0:row.lunchweek);
-//
-
-
-
- //expdata += "P;"+ ccreche.sqldata[0].idcheckservice +";"+";;;;;;;;;;;;;;;";
- }
- for (var o in allobjects){
- var obj = allobjects[o];
- expdata += "P;" + idchkserv + ";"+ obj.cs + ";";
- for (var w in obj.weeks){
- expdata += obj.weeks[w].time + ";" + obj.weeks[w].lunch + ";";
- }
- if (wlen == 3){
- expdata += "0,00;0;0,00;0;";
- }
- if (wlen == 4){
- expdata += "0,00;0;";
- }
- expdata += "0,00;;0,00;0,00;0,00\r\n";
- //dump(key(allobjects[0]) + "\n");
- }
- //dump(JSON.stringify(allobjects) + "\n");
- system.WriteTextFile(expdata,expfolder.path + system.sep() + val + "_export_checkservice.csv");
- //dump(expdata);
-}
-
-function openmonthlypdf(){
- dump("PDF to Open: " + mpdffile + "\n");
- var ff = system.openFile(mpdffile);
-}
-
+++ /dev/null
-//Source-code licensed under EUPL v1.1 ( Copyright 2016 By DKS s.à r.l. - Kilian Saffran - Luxembourg )
-
-var pconfig = {};
-var winh= window.innerHeight -170;
-var tblacc = null;
-var curchilduuid = '';
-var crecheuuid = null;
-var importpath = null;
-var delacc = {};
-//var lictype = apppref.getpreference("support.lictype");
-
-function initdata(){
- curcfg.loadconfig(apppref.getpreference("support.database.currentdb.num"));
- load_helpers();
- var configdata = apppref.getpreference("pageconfig.accountingchild");
- if (configdata != '') {
- pconfig = JSON.parse(configdata);
- }
- if (!pconfig.printlayout) {
- pconfig.printlayout = 'list';
- apppref.setpreference("pageconfig.accountingchild",pconfig);
- }
- var ccreche = appdb.dbquery("select uuid from creche LIMIT 1;");
- crecheuuid = ccreche.sqldata[0].uuid;
- importpath = FileUtils.File(curcfg.path.local + system.sep() +"imports" + system.sep() + crecheuuid);
- //check_accountingtable();
- load_childlist();
- if (pconfig.accchild) {
- //
-
- $("#accchild").val(pconfig.accchild);
- }else {
- $("#accchild").val($("#accchild option:first").val());
- pconfig.accchild=$("#accchild option:first").val();
- }
- if (!pconfig.accyear){
- pconfig.accyear=new Date().toLocaleFormat("%Y");
- apppref.setpreference("pageconfig.accountingchild",pconfig);
- }
- //if (lictype != "free"){
- // $("#mnuacc").css({"position":"absolute","z-index":"1000"});
- //}
- set_selectyears();
- ////cdate = initdate.toLocaleFormat('%Y-%m-%d');
- set_infoheader($("#accchild option:selected").text() + " Année:" + pconfig.accyear);
- //load_column_selection();
- load_accounting_table();
-
-}
-
-
-
-function load_accounting_table(){
- //dump("accountingchild: " + JSON.stringify(pconfig) + "\n");
- // var daterangesql = "select case when strftime('%Y',date(yeardaybegin)) == '"+pconfig.accyear+"' then yeardaybegin else strftime('%Y-%m-%d',date(date(yeardaybegin),'+7 days')) end as yeardaybegin,"+
- // "strftime('%Y-%m-%d',date(date(yeardayend),'+6 days')) as yeardayend "+
- // "from ( " +
- // "select case when strftime('%w','"+pconfig.accyear+"-01-01') = '1' then strftime('%Y-%m-%d','"+pconfig.accyear+"-01-01') else strftime('%Y-%m-%d', date(date('"+pconfig.accyear+"-01-01','-7 days'),'weekday 1')) end as yeardaybegin, "+
- // "case when strftime('%w','"+pconfig.accyear+"-12-31') = '1' then strftime('%Y-%m-%d','"+pconfig.accyear+"-12-31') else strftime('%Y-%m-%d', date(date('"+pconfig.accyear+"-12-31','-7 days'),'weekday 1')) end as yeardayend "+
- // ");";
- // var daterange = appdb.dbquery(daterangesql);
- // daterange = daterange.sqldata[0];
- // var yearmin = daterange.yeardaybegin;
- // var yearmax = daterange.yeardayend;
-
-
- // var chbornes = appdb.dbquery("select min(daydate) as mindate,max(daydate) as maxdate from presence where strftime('%Y',daydate)='" + pconfig.accyear + "' and childuuid='" + pconfig.accchild + "';");
-
- // var monthmin= chbornes.sqldata[0].mindate;
- // var monthmax= chbornes.sqldata[0].maxdate;
- var accsql = "select strftime('%m.%Y', acc.accmonth) as calmonth," +
- "case when nocheckservice = '1' then '<span style=\"color: red;\">(facture non check-service)</span><br/>' else '' end || acc.reference as reference, "+
- " case when acc.invoiceamount is not null then printf(\"%.2f\", COALESCE(acc.invoiceamount, 0.00)) || '€' || " +
- " case when acc.invoicedate is not null then '<br/>(' || strftime('%d.%m.%Y', acc.invoicedate) || ')' || " +
- " CASE WHEN acc.reminderdate1 IS NOT NULL THEN '<br/>R1:' || strftime('%d.%m.%Y', acc.reminderdate1) ELSE '' END || "+
- " CASE WHEN acc.reminderdate2 IS NOT NULL THEN '<br/>R2:' || strftime('%d.%m.%Y', acc.reminderdate2) ELSE '' END || "+
- " CASE WHEN acc.reminderdate3 IS NOT NULL THEN '<br/>R3:' || strftime('%d.%m.%Y', acc.reminderdate3) ELSE '' END else '' end else '' end as invoiced,"+
- " case when acc.payedamount is not null then printf(\"%.2f\", COALESCE(acc.payedamount, 0.00)) || '€' || "+
- " case when acc.payeddate is not null then '<br/>(' || strftime('%d.%m.%Y', acc.payeddate) || ')' else '' end else '' end as payement, "+
- " case when acc.benefitamount is not null then printf(\"%.2f\",COALESCE(acc.benefitamount,0.00)) || '€' else '' end as benefitamount," +
- " '<button type=\"button\" class=\"btn btn-primary\" onclick=\"dlg_accounting(''' || acc.uuid || ''');\" title=\"editer\"><span class=\"glyphicon glyphicon-pencil\"></span></button>' || " +
- " CASE WHEN acc.invoicefile IS NOT NULL and acc.invoicefile != '' THEN '<button type=\"button\" class=\"btn btn-primary\" onclick=\"openfile(''' || acc.invoicefile || ''');\" title=\"editer\"><span class=\"glyphicon glyphicon-open\"></span>' else '' end || CASE WHEN acc.childuuid IS NOT NULL AND acc.accmonth IS NOT NULL THEN '<button type=\"button\" class=\"btn btn-danger\" onclick=\" confirm_delete_accounting(''' || acc.uuid || ''');\" title=\"supprimer\"><span class=\"glyphicon glyphicon-remove\"></span></button>' ELSE '' END AS act " +
- " from accounting acc where childuuid='"+ pconfig.accchild+"' and strftime('%Y',acc.accmonth) = '" + pconfig.accyear +"' order by accmonth;";
-
-// var accsql = "select strftime( '%m.%Y',acc.accmonth) as calmonth,'' as weekdetails, '' as monthtotalhourcosts,'' as monthtotallunchcosts, '' as monthtotalcosts,replace(acc.reference,'NOCHECKSERVICE:','<span style=\"color: red;\">(facture non check-service)</span><br/>') as reference, " +
-// "case when acc.invoiceamount is not null then printf(\"%.2f\",COALESCE(acc.invoiceamount,0.00)) || '€' || case when acc.invoicedate is not null then '<br/>(' || strftime('%d.%m.%Y',acc.invoicedate) || ')' || CASE WHEN acc.reminderdate1 IS NOT NULL THEN '<br/>R1:' || strftime('%d.%m.%Y',acc.reminderdate1) ELSE '' END || CASE WHEN acc.reminderdate2 IS NOT NULL THEN '<br/>R2:' || strftime('%d.%m.%Y',acc.reminderdate2) ELSE '' END || CASE WHEN acc.reminderdate3 IS NOT NULL THEN '<br/>R3:' || strftime('%d.%m.%Y',acc.reminderdate3) ELSE '' END else '' end else '' end as invoiced, " +
-// "case when acc.payedamount is not null then printf(\"%.2f\",COALESCE(acc.payedamount,0.00)) || '€' || case when acc.payeddate is not null then '<br/>(' || strftime('%d.%m.%Y',acc.payeddate) || ')' else '' end else '' end as payement," +
-// "'' as benefitamount," +
-// "'<button type=\"button\" class=\"btn btn-primary\" onclick=\"dlg_accounting(''' || acc.uuid || ''');\" title=\"editer\"><span class=\"glyphicon glyphicon-pencil\"></span></button>' || CASE WHEN acc.invoicefile IS NOT NULL and acc.invoicefile != '' THEN '<button type=\"button\" class=\"btn btn-primary\" onclick=\"openfile(''' || acc.invoicefile || ''');\" title=\"editer\"><span class=\"glyphicon glyphicon-open\"></span>' else '' end || CASE WHEN acc.childuuid IS NOT NULL AND acc.accmonth IS NOT NULL THEN '<button type=\"button\" class=\"btn btn-danger\" onclick=\" confirm_delete_accounting(''' || acc.uuid || ''');\" title=\"supprimer\"><span class=\"glyphicon glyphicon-remove\"></span></button>' ELSE '' END AS act " +
-// " from accounting acc where acc.childuuid='"+ pconfig.accchild +"' and strftime( '%Y',acc.accmonth)='"+pconfig.accyear+"' and acc.reference LIKE 'NOCHECKSERVICE:%' "
-// //|| ' (' || weekhourcosts || '€/h)' -- || ' (' || weeklunchcosts || '€/déj.)
-// accsql += "UNION SELECT calmonth, " +
-// "group_concat( '<span class=\"glyphicon glyphicon-calendar\"></span>:' || calweek || ' <span class=\"glyphicon glyphicon-time\"></span>: ' || durationweek || ' h <span class=\"glyphicon glyphicon-cutlery\"></span>: ' || lunchweek ,'<br/>') AS weekdetails, " +
-// "printf(\"%.2f\",SUM(weektotalhourcosts)) AS monthtotalhourcosts, " +
-// "printf(\"%.2f\",SUM(weektotallunchcosts)) AS monthtotallunchcosts, " +
-// "printf(\"%.2f\",SUM(weektotalhourcosts + weektotallunchcosts)) AS monthtotalcosts, " +
-// "reference, " +
-// "invoiced,payement,benefitamount,act FROM ( " +
-// "SELECT childname,ttl.childuuid,printf(\"%02d\",calweek) AS calweek,calmonth, " +
-// "printf(\"%.2f\",sumdurationcalweek) AS durationweek, " +
-// "sumlunchcalweek AS lunchweek, " +
-// "printf(\"%.2f\",weekhourcosts) AS weekhourcosts, " +
-// "printf(\"%.2f\",weeklunchcosts) AS weeklunchcosts, " +
-// "sumdurationcalweek * weekhourcosts AS weektotalhourcosts, " +
-// "sumlunchcalweek * weeklunchcosts AS weektotallunchcosts, " +
-// "REPLACE(acc.reference,'NOCHECKSERVICE:','') as reference," +
-// "case when acc.invoiceamount is not null then printf(\"%.2f\",COALESCE(acc.invoiceamount,0.00)) || '€' || case when acc.invoicedate is not null then '<br/>(' || strftime('%d.%m.%Y',acc.invoicedate) || ')' || CASE WHEN acc.reminderdate1 IS NOT NULL THEN '<br/>R1:' || strftime('%d.%m.%Y',acc.reminderdate1) ELSE '' END || CASE WHEN acc.reminderdate2 IS NOT NULL THEN '<br/>R2:' || strftime('%d.%m.%Y',acc.reminderdate2) ELSE '' END || CASE WHEN acc.reminderdate3 IS NOT NULL THEN '<br/>R3:' || strftime('%d.%m.%Y',acc.reminderdate3) ELSE '' END else '' end else '' end as invoiced, " +
-// "case when acc.payedamount is not null then printf(\"%.2f\",COALESCE(acc.payedamount,0.00)) || '€' || case when acc.payeddate is not null then '<br/>(' || strftime('%d.%m.%Y',acc.payeddate) || ')' else '' end else '' end as payement," +
-// "case when acc.benefitamount is not null then printf(\"%.2f\",COALESCE(acc.benefitamount,0.00)) || '€' else '' end as benefitamount," +
-// "'<button type=\"button\" class=\"btn btn-primary\" onclick=\"dlg_accounting(''' || acc.uuid || ''');\" title=\"editer\"><span class=\"glyphicon glyphicon-pencil\"></span></button>' || CASE WHEN acc.invoicefile IS NOT NULL and acc.invoicefile != '' THEN '<button type=\"button\" class=\"btn btn-primary\" onclick=\"openfile(''' || acc.invoicefile || ''');\" title=\"editer\"><span class=\"glyphicon glyphicon-open\"></span>' else '' end || CASE WHEN acc.childuuid IS NOT NULL AND acc.accmonth IS NOT NULL THEN '<button type=\"button\" class=\"btn btn-danger\" onclick=\" confirm_delete_accounting(''' || acc.uuid || ''');\" title=\"supprimer\"><span class=\"glyphicon glyphicon-remove\"></span></button>' ELSE '' END AS act " +
-// "FROM ( SELECT pch.childname, pch.childuuid, px.calweek, px.calmonth, px.sumdurationcalweek, px.sumlunchcalweek, " +
-// "CASE WHEN px.sumdurationcalweek IS NOT NULL AND pch.checkservicenumber IS NOT NULL THEN ( SELECT coalesce(wc0.costsperhour,0.00) FROM costs wc0 WHERE wc0.startdate < date('"+yearmin+"','+' || caldays || ' days') and wc0.weeklyhourslimit <= px.sumdurationcalweek ORDER BY wc0.startdate DESC,wc0.weeklyhourslimit DESC LIMIT 1 ) WHEN px.sumdurationcalweek IS NOT NULL AND pch.checkservicenumber IS NULL THEN ( SELECT coalesce(wc0.costperhourfallback,0.00) FROM costs wc0 WHERE wc0.startdate < date('"+yearmin+"','+' || caldays || ' days') and wc0.weeklyhourslimit <= px.sumdurationcalweek ORDER BY wc0.startdate DESC,wc0.weeklyhourslimit DESC LIMIT 1 ) ELSE NULL END AS weekhourcosts,"+
-
-// "CASE WHEN px.sumlunchcalweek IS NOT NULL THEN ( SELECT coalesce(wc0.dailylunchcosts,0.00) FROM costs wc0 WHERE wc0.startdate < date('"+yearmin+"','+' || caldays || ' days') and wc0.weeklyhourslimit <= px.sumdurationcalweek ORDER BY wc0.startdate DESC,wc0.weeklyhourslimit DESC LIMIT 1) ELSE NULL END AS weeklunchcosts " +
-// "FROM ( SELECT COALESCE(ch.prename,'') || ' ' || COALESCE(ch.surname,'') || '<br>(' || " +
-// "COALESCE(ch.checkservicenumber,'') || ')' AS childname,ch.uuid AS childuuid,ch.checkservicenumber " +
-// "FROM childs ch JOIN planning pl ON ( ch.uuid=pl.childuuid) WHERE childuuid='"+pconfig.accchild+"' ) pch " +
-// "LEFT JOIN ( SELECT childuuid, calweek, case when strftime('%w',date(calyear ||'-01-01')) in ('1','2','3','4') then (cast(calweek as int)*7)-7 else (cast(calweek as int)*7) end as caldays ,calmonth, sumlunchcalweek, COALESCE(SUM(monduration + tueduration + wedduration + thuduration + friduration),0.0) AS sumdurationcalweek FROM " +
-// "( SELECT childuuid, daydate, calyear,"
-// +"case when strftime('%w',date(calyear ||'-01-01')) in ('1','2','3','4') then case when calweek < '10' then '0' else '' end || cast(calweek as int)+1 else calweek end as calweek,"
-// +"calmonth, MAX(monlunch) + MAX(tuelunch) + MAX(wedlunch) + MAX(thulunch) + MAX(frilunch) AS sumlunchcalweek, MAX(monduration) + MAX(monduration2) AS monduration, MAX(tueduration) + MAX(tueduration2) AS tueduration, MAX(wedduration) + MAX(wedduration2) AS wedduration, MAX(thuduration) + MAX(thuduration2) AS thuduration, MAX(friduration) + MAX(friduration2) AS friduration FROM " +
-// "( SELECT xx.childuuid, xx.daydate,strftime('%Y',xx.daydate) as calyear, " +
-// "case when strftime('%w',xx.daydate)='0' then strftime('%W',date(xx.daydate,'-6 days')) else strftime('%W',date(date(xx.daydate),'-' || strftime('%w',date(xx.daydate)) || ' days','+1 day')) end as calweek, " +
-// "case when strftime('%w',xx.daydate)='0' then strftime('%m.%Y',date(xx.daydate,'-6 days')) else strftime('%m.%Y',date(date(xx.daydate),'-' || strftime('%w',date(xx.daydate)) || ' days','+1 day')) end as calmonth, ";
-// var aax = ['mon','tue','wed','thu','fri','sat'];
-// for (var d1 in aax){
-// var dw = d1;dw++;
-// accsql += "CASE WHEN lunch=1 AND status IN (1,5) AND strftime('%w',daydate) = '"+dw+"' THEN 1 ELSE 0 END AS "+aax[d1]+"lunch,";
-// }
-
-// for (var d2 in aax){
-// var dw2 = d2;dw2++;
-// accsql += "CASE WHEN xx.status IS NOT NULL AND strftime('%w',xx.daydate) = '"+dw2+"' AND xx.daydate BETWEEN xx.datebegin AND xx.dateend THEN CAST(( (( CAST(SUBSTR(xx."+ aax[d2]+"timeend,1,2) AS INT) *3600)+( CAST(SUBSTR(xx."+ aax[d2]+"timeend,4,2) AS INT) *60))- ((CAST(SUBSTR(xx."+ aax[d2]+"timebegin,1,2) AS INT) *3600)+( CAST(SUBSTR(xx."+ aax[d2]+"timebegin,4,2) AS INT) *60)) ) / 3600 AS REAL) ELSE 0.0 END AS "+ aax[d2]+"duration,";
-// }
-
-
-// for (var d3 in aax){
-// var dw3 = d3;dw3++;
-// accsql += "CASE WHEN xx.status IS NOT NULL AND strftime('%w',xx.daydate) = '"+dw3+"' AND xx.daydate BETWEEN xx.datebegin AND xx.dateend AND xx."+ aax[d3]+"timebegin2 IS NOT NULL AND xx."+ aax[d3]+"timeend2 IS NOT NULL THEN CAST(( (( CAST(SUBSTR(xx."+ aax[d3]+"timeend2,1,2) AS INT) *3600)+( CAST(SUBSTR(xx."+ aax[d3]+"timeend2,4,2) AS INT) *60))- ((CAST(SUBSTR(xx."+ aax[d3]+"timebegin2,1,2) AS INT) *3600)+( CAST(SUBSTR(xx."+ aax[d3]+"timebegin2,4,2) AS INT) *60)) ) / 3600 AS REAL) ELSE 0.0 END AS "+ aax[d3]+"duration2,";
-// }
-
-// accsql += "null as nouse FROM (" +
-// " select vacancydate as daydate, CAST('0' as boolean) as lunch,1 as status,pl.* from vacancy va " +
-// " left join planning pl on (va.vacancydate between pl.datebegin and pl.dateend and pl.childuuid='"+pconfig.accchild+"') " +
-// " where va.vacancydateto is null and va.vacancydate BETWEEN '"+monthmin+"' AND '"+monthmax+"' AND strftime('%w',va.vacancydate) not in ('0') " +
-// " group by va.vacancydate,pl.childuuid " +
-// " union " +
-// " select pr.daydate,pr.lunch,pr.status,pl.* FROM presence pr " +
-// " JOIN planning pl ON ( pr.childuuid=pl.childuuid and pr.childuuid='"+pconfig.accchild+"') WHERE pr.daydate BETWEEN '"+monthmin+"' AND '"+monthmax+"' "+
-// ") xx " +
-// "WHERE xx.daydate BETWEEN '"+monthmin+"' AND '"+monthmax+"') GROUP BY calweek) GROUP BY calweek) px " +
-// "ON ( pch.childuuid=px.childuuid) GROUP BY px.calweek ) ttl LEFT JOIN accounting acc ON (ttl.childuuid = acc.childuuid AND ttl.calmonth=strftime('%m.%Y',acc.accmonth) AND acc.reference NOT LIKE 'NOCHECKSERVICE:%') WHERE calweek IS NOT NULL) group by calmonth ORDER BY calmonth; ";var accsql = "select strftime( '%m.%Y',acc.accmonth) as calmonth,'' as weekdetails, '' as monthtotalhourcosts,'' as monthtotallunchcosts, '' as monthtotalcosts,replace(acc.reference,'NOCHECKSERVICE:','<span style=\"color: red;\">(facture non check-service)</span><br/>') as reference, " +
-// "case when acc.invoiceamount is not null then printf(\"%.2f\",COALESCE(acc.invoiceamount,0.00)) || '€' || case when acc.invoicedate is not null then '<br/>(' || strftime('%d.%m.%Y',acc.invoicedate) || ')' || CASE WHEN acc.reminderdate1 IS NOT NULL THEN '<br/>R1:' || strftime('%d.%m.%Y',acc.reminderdate1) ELSE '' END || CASE WHEN acc.reminderdate2 IS NOT NULL THEN '<br/>R2:' || strftime('%d.%m.%Y',acc.reminderdate2) ELSE '' END || CASE WHEN acc.reminderdate3 IS NOT NULL THEN '<br/>R3:' || strftime('%d.%m.%Y',acc.reminderdate3) ELSE '' END else '' end else '' end as invoiced, " +
-// "case when acc.payedamount is not null then printf(\"%.2f\",COALESCE(acc.payedamount,0.00)) || '€' || case when acc.payeddate is not null then '<br/>(' || strftime('%d.%m.%Y',acc.payeddate) || ')' else '' end else '' end as payement," +
-// "'' as benefitamount," +
-// "'<button type=\"button\" class=\"btn btn-primary\" onclick=\"dlg_accounting(''' || acc.uuid || ''');\" title=\"editer\"><span class=\"glyphicon glyphicon-pencil\"></span></button>' || CASE WHEN acc.invoicefile IS NOT NULL and acc.invoicefile != '' THEN '<button type=\"button\" class=\"btn btn-primary\" onclick=\"openfile(''' || acc.invoicefile || ''');\" title=\"editer\"><span class=\"glyphicon glyphicon-open\"></span>' else '' end || CASE WHEN acc.childuuid IS NOT NULL AND acc.accmonth IS NOT NULL THEN '<button type=\"button\" class=\"btn btn-danger\" onclick=\" confirm_delete_accounting(''' || acc.uuid || ''');\" title=\"supprimer\"><span class=\"glyphicon glyphicon-remove\"></span></button>' ELSE '' END AS act " +
-// " from accounting acc where acc.childuuid='"+ pconfig.accchild +"' and strftime( '%Y',acc.accmonth)='"+pconfig.accyear+"' and acc.reference LIKE 'NOCHECKSERVICE:%' "
-// //|| ' (' || weekhourcosts || '€/h)' -- || ' (' || weeklunchcosts || '€/déj.)
-// accsql += "UNION SELECT calmonth, " +
-// "group_concat( '<span class=\"glyphicon glyphicon-calendar\"></span>:' || calweek || ' <span class=\"glyphicon glyphicon-time\"></span>: ' || durationweek || ' h <span class=\"glyphicon glyphicon-cutlery\"></span>: ' || lunchweek ,'<br/>') AS weekdetails, " +
-// "printf(\"%.2f\",SUM(weektotalhourcosts)) AS monthtotalhourcosts, " +
-// "printf(\"%.2f\",SUM(weektotallunchcosts)) AS monthtotallunchcosts, " +
-// "printf(\"%.2f\",SUM(weektotalhourcosts + weektotallunchcosts)) AS monthtotalcosts, " +
-// "reference, " +
-// "invoiced,payement,benefitamount,act FROM ( " +
-// "SELECT childname,ttl.childuuid,printf(\"%02d\",calweek) AS calweek,calmonth, " +
-// "printf(\"%.2f\",sumdurationcalweek) AS durationweek, " +
-// "sumlunchcalweek AS lunchweek, " +
-// "printf(\"%.2f\",weekhourcosts) AS weekhourcosts, " +
-// "printf(\"%.2f\",weeklunchcosts) AS weeklunchcosts, " +
-// "sumdurationcalweek * weekhourcosts AS weektotalhourcosts, " +
-// "sumlunchcalweek * weeklunchcosts AS weektotallunchcosts, " +
-// "REPLACE(acc.reference,'NOCHECKSERVICE:','') as reference," +
-// "case when acc.invoiceamount is not null then printf(\"%.2f\",COALESCE(acc.invoiceamount,0.00)) || '€' || case when acc.invoicedate is not null then '<br/>(' || strftime('%d.%m.%Y',acc.invoicedate) || ')' || CASE WHEN acc.reminderdate1 IS NOT NULL THEN '<br/>R1:' || strftime('%d.%m.%Y',acc.reminderdate1) ELSE '' END || CASE WHEN acc.reminderdate2 IS NOT NULL THEN '<br/>R2:' || strftime('%d.%m.%Y',acc.reminderdate2) ELSE '' END || CASE WHEN acc.reminderdate3 IS NOT NULL THEN '<br/>R3:' || strftime('%d.%m.%Y',acc.reminderdate3) ELSE '' END else '' end else '' end as invoiced, " +
-// "case when acc.payedamount is not null then printf(\"%.2f\",COALESCE(acc.payedamount,0.00)) || '€' || case when acc.payeddate is not null then '<br/>(' || strftime('%d.%m.%Y',acc.payeddate) || ')' else '' end else '' end as payement," +
-// "case when acc.benefitamount is not null then printf(\"%.2f\",COALESCE(acc.benefitamount,0.00)) || '€' else '' end as benefitamount," +
-// "'<button type=\"button\" class=\"btn btn-primary\" onclick=\"dlg_accounting(''' || acc.uuid || ''');\" title=\"editer\"><span class=\"glyphicon glyphicon-pencil\"></span></button>' || CASE WHEN acc.invoicefile IS NOT NULL and acc.invoicefile != '' THEN '<button type=\"button\" class=\"btn btn-primary\" onclick=\"openfile(''' || acc.invoicefile || ''');\" title=\"editer\"><span class=\"glyphicon glyphicon-open\"></span>' else '' end || CASE WHEN acc.childuuid IS NOT NULL AND acc.accmonth IS NOT NULL THEN '<button type=\"button\" class=\"btn btn-danger\" onclick=\" confirm_delete_accounting(''' || acc.uuid || ''');\" title=\"supprimer\"><span class=\"glyphicon glyphicon-remove\"></span></button>' ELSE '' END AS act " +
-// "FROM ( SELECT pch.childname, pch.childuuid, px.calweek, px.calmonth, px.sumdurationcalweek, px.sumlunchcalweek, " +
-// "CASE WHEN px.sumdurationcalweek IS NOT NULL AND pch.checkservicenumber IS NOT NULL THEN ( SELECT coalesce(wc0.costsperhour,0.00) FROM costs wc0 WHERE wc0.startdate < date('"+yearmin+"','+' || caldays || ' days') and wc0.weeklyhourslimit <= px.sumdurationcalweek ORDER BY wc0.startdate DESC,wc0.weeklyhourslimit DESC LIMIT 1 ) WHEN px.sumdurationcalweek IS NOT NULL AND pch.checkservicenumber IS NULL THEN ( SELECT coalesce(wc0.costperhourfallback,0.00) FROM costs wc0 WHERE wc0.startdate < date('"+yearmin+"','+' || caldays || ' days') and wc0.weeklyhourslimit <= px.sumdurationcalweek ORDER BY wc0.startdate DESC,wc0.weeklyhourslimit DESC LIMIT 1 ) ELSE NULL END AS weekhourcosts,"+
-
-// "CASE WHEN px.sumlunchcalweek IS NOT NULL THEN ( SELECT coalesce(wc0.dailylunchcosts,0.00) FROM costs wc0 WHERE wc0.startdate < date('"+yearmin+"','+' || caldays || ' days') and wc0.weeklyhourslimit <= px.sumdurationcalweek ORDER BY wc0.startdate DESC,wc0.weeklyhourslimit DESC LIMIT 1) ELSE NULL END AS weeklunchcosts " +
-// "FROM ( SELECT COALESCE(ch.prename,'') || ' ' || COALESCE(ch.surname,'') || '<br>(' || " +
-// "COALESCE(ch.checkservicenumber,'') || ')' AS childname,ch.uuid AS childuuid,ch.checkservicenumber " +
-// "FROM childs ch JOIN planning pl ON ( ch.uuid=pl.childuuid) WHERE childuuid='"+pconfig.accchild+"' ) pch " +
-// "LEFT JOIN ( SELECT childuuid, calweek, case when strftime('%w',date(calyear ||'-01-01')) in ('1','2','3','4') then (cast(calweek as int)*7)-7 else (cast(calweek as int)*7) end as caldays ,calmonth, sumlunchcalweek, COALESCE(SUM(monduration + tueduration + wedduration + thuduration + friduration),0.0) AS sumdurationcalweek FROM " +
-// "( SELECT childuuid, daydate, calyear,"
-// +"case when strftime('%w',date(calyear ||'-01-01')) in ('1','2','3','4') then case when calweek < '10' then '0' else '' end || cast(calweek as int)+1 else calweek end as calweek,"
-// +"calmonth, MAX(monlunch) + MAX(tuelunch) + MAX(wedlunch) + MAX(thulunch) + MAX(frilunch) AS sumlunchcalweek, MAX(monduration) + MAX(monduration2) AS monduration, MAX(tueduration) + MAX(tueduration2) AS tueduration, MAX(wedduration) + MAX(wedduration2) AS wedduration, MAX(thuduration) + MAX(thuduration2) AS thuduration, MAX(friduration) + MAX(friduration2) AS friduration FROM " +
-// "( SELECT xx.childuuid, xx.daydate,strftime('%Y',xx.daydate) as calyear, " +
-// "case when strftime('%w',xx.daydate)='0' then strftime('%W',date(xx.daydate,'-6 days')) else strftime('%W',date(date(xx.daydate),'-' || strftime('%w',date(xx.daydate)) || ' days','+1 day')) end as calweek, " +
-// "case when strftime('%w',xx.daydate)='0' then strftime('%m.%Y',date(xx.daydate,'-6 days')) else strftime('%m.%Y',date(date(xx.daydate),'-' || strftime('%w',date(xx.daydate)) || ' days','+1 day')) end as calmonth, ";
-// var aax = ['mon','tue','wed','thu','fri','sat'];
-// for (var d1 in aax){
-// var dw = d1;dw++;
-// accsql += "CASE WHEN lunch=1 AND status IN (1,5) AND strftime('%w',daydate) = '"+dw+"' THEN 1 ELSE 0 END AS "+aax[d1]+"lunch,";
-// }
-
-// for (var d2 in aax){
-// var dw2 = d2;dw2++;
-// accsql += "CASE WHEN xx.status IS NOT NULL AND strftime('%w',xx.daydate) = '"+dw2+"' AND xx.daydate BETWEEN xx.datebegin AND xx.dateend THEN CAST(( (( CAST(SUBSTR(xx."+ aax[d2]+"timeend,1,2) AS INT) *3600)+( CAST(SUBSTR(xx."+ aax[d2]+"timeend,4,2) AS INT) *60))- ((CAST(SUBSTR(xx."+ aax[d2]+"timebegin,1,2) AS INT) *3600)+( CAST(SUBSTR(xx."+ aax[d2]+"timebegin,4,2) AS INT) *60)) ) / 3600 AS REAL) ELSE 0.0 END AS "+ aax[d2]+"duration,";
-// }
-
-
-// for (var d3 in aax){
-// var dw3 = d3;dw3++;
-// accsql += "CASE WHEN xx.status IS NOT NULL AND strftime('%w',xx.daydate) = '"+dw3+"' AND xx.daydate BETWEEN xx.datebegin AND xx.dateend AND xx."+ aax[d3]+"timebegin2 IS NOT NULL AND xx."+ aax[d3]+"timeend2 IS NOT NULL THEN CAST(( (( CAST(SUBSTR(xx."+ aax[d3]+"timeend2,1,2) AS INT) *3600)+( CAST(SUBSTR(xx."+ aax[d3]+"timeend2,4,2) AS INT) *60))- ((CAST(SUBSTR(xx."+ aax[d3]+"timebegin2,1,2) AS INT) *3600)+( CAST(SUBSTR(xx."+ aax[d3]+"timebegin2,4,2) AS INT) *60)) ) / 3600 AS REAL) ELSE 0.0 END AS "+ aax[d3]+"duration2,";
-// }
-
-// accsql += "null as nouse FROM (" +
-// " select vacancydate as daydate, CAST('0' as boolean) as lunch,1 as status,pl.* from vacancy va " +
-// " left join planning pl on (va.vacancydate between pl.datebegin and pl.dateend and pl.childuuid='"+pconfig.accchild+"') " +
-// " where va.vacancydateto is null and va.vacancydate BETWEEN '"+monthmin+"' AND '"+monthmax+"' AND strftime('%w',va.vacancydate) not in ('0') " +
-// " group by va.vacancydate,pl.childuuid " +
-// " union " +
-// " select pr.daydate,pr.lunch,pr.status,pl.* FROM presence pr " +
-// " JOIN planning pl ON ( pr.childuuid=pl.childuuid and pr.childuuid='"+pconfig.accchild+"') WHERE pr.daydate BETWEEN '"+monthmin+"' AND '"+monthmax+"' "+
-// ") xx " +
-// "WHERE xx.daydate BETWEEN '"+monthmin+"' AND '"+monthmax+"') GROUP BY calweek) GROUP BY calweek) px " +
-// "ON ( pch.childuuid=px.childuuid) GROUP BY px.calweek ) ttl LEFT JOIN accounting acc ON (ttl.childuuid = acc.childuuid AND ttl.calmonth=strftime('%m.%Y',acc.accmonth) AND acc.reference NOT LIKE 'NOCHECKSERVICE:%') WHERE calweek IS NOT NULL) group by calmonth ORDER BY calmonth; ";
- //jsdump("accsql");
- //jsdump(accsql);
-
- var accdata = appdb.dbquery(accsql);
- jsdump("accchildsql");
- jsdump(accsql);
- var headerdata = getlabels("calmonth,reference,invoiced,payement,benefitamount,act");
- //,monthtotalhourcosts,monthtotallunchcosts,monthtotalcosts
-
-
- $("#tbl_accounting").html("");
-
- //var hrow = headerdata;
- //var tdclass= new Array();
- var tblheader = '<tr>';
-
- for (var h in headerdata){
- if ((headerdata[h].keyname == 'act') && (headerdata[h].class.indexOf('action1btn') == -1)){
- headerdata[h].class +=" action1btn";
- }
- //if ((pconfig.hidden_columns) && (pconfig.hidden_columns.indexOf(headerdata[h].keyname) != -1)) {
- // if (headerdata[h].class.indexOf('colhidden') == -1) {
- // headerdata[h].class += " colhidden";
- // }
- //}else {
- headerdata[h].class.replace("colhidden","");
- //}
- tblheader += '<th class="' + headerdata[h].class +'">'+ headerdata[h].title+'</th>';
-
- }
- tblheader += '</tr>';
-
-
- $("#tbl_accounting").append("<thead>" + tblheader + "</thead>");
- $("#tbl_accounting").append("<tfoot>" + tblheader + "</tfoot>");
- $("#tbl_accounting").append("<tbody>");
-
- var curchld = "";
-
- for (var i in accdata.sqldata){
- var row = accdata.sqldata[i];
- var tr = '<tr><td>' + row.calmonth + '</td>';
- //tr += '<td class="infoweek noprint '+ (((pconfig.hidden_columns) && (pconfig.hidden_columns.indexOf('weekdetails') != -1))?" colhidden":"") +'">' + row.weekdetails + '</td>';
- //tr += '<td class="alignright totalwidth '+ (((pconfig.hidden_columns) && (pconfig.hidden_columns.indexOf('monthtotalhourcosts') != -1))?" colhidden":"") +'">' + row.monthtotalhourcosts + '€</td>';
- //tr += '<td class="alignright totalwidth '+ (((pconfig.hidden_columns) && (pconfig.hidden_columns.indexOf('monthtotallunchcosts') != -1))?" colhidden":"") +'">' + row.monthtotallunchcosts + '€</td>';
- //tr += '<td class="alignright totalwidth '+ (((pconfig.hidden_columns) && (pconfig.hidden_columns.indexOf('monthtotalcosts') != -1))?" colhidden":"") +'">' + row.monthtotalcosts + '€</td>';
- tr += '<td>'+row.reference+'</td>';
- tr += '<td class="alignright '+ (((pconfig.hidden_columns) && (pconfig.hidden_columns.indexOf('invoiced') != -1))?" colhidden":"") +'">' + row.invoiced + '</td>';
- tr += '<td class="alignright '+ (((pconfig.hidden_columns) && (pconfig.hidden_columns.indexOf('payement') != -1))?" colhidden":"") +'">' + row.payement + '</td>';
- tr += '<td class="alignright totalwidth '+ (((pconfig.hidden_columns) && (pconfig.hidden_columns.indexOf('benefitamount') != -1))?" colhidden":"") +'">' + row.benefitamount + '</td>';
- tr += '<td class="noprint">' + row.act + '</td></tr>';
- $("#tbl_accounting").append(tr);
- }
-
- $("#tbl_accounting").append("</tbody>");
-
-
- tblacc = $("#tbl_accounting").dataTable({
- "language": {
- "url": "../../web/js/locale/datatable_fr.json"
- },
- "paging": false,
- "ordering": true,
- "bAutoWidth": false,
- "scrollY": winh + "px",
- "scrollCollapse": true,
- "info": false,
- "filter": true,
- "destroy": true,
- "footerCallback": function ( row, data, start, end, display ) {
- var api = this.api(), data;
-
- var intVal = function ( i ) {
- return typeof i === 'string' ?
- i.substring(0,i.indexOf("\€"))*1 :
- typeof i === 'number' ?
- i : 0;
- };
-
- //hTotal = api
- // .column( 2, { page: 'current'} )
- // .data()
- // .reduce( function (a, b) {
- // return intVal(a) + intVal(b);
- // }, 0 );
-
- //lTotal = api
- // .column( 3, { page: 'current'} )
- // .data()
- // .reduce( function (a, b) {
- // return intVal(a) + intVal(b);
- // }, 0 );
- fTotal = api
- .column( 2, { page: 'current'} )
- .data()
- .reduce( function (a, b) {
- return intVal(a) + intVal(b);
- }, 0 );
- pTotal = api
- .column( 3, { page: 'current'} )
- .data()
- .reduce( function (a, b) {
- return intVal(a) + intVal(b);
- }, 0 );
- bTotal = api
- .column( 4, { page: 'current'} )
- .data()
- .reduce( function (a, b) {
- return intVal(a) + intVal(b);
- }, 0 );
- //pageTotal = api
- // .column( 4, { page: 'current'} )
- // .data()
- // .reduce( function (a, b) {
- // return intVal(a) + intVal(b);
- // }, 0 );
-
- // Update footer
- $( api.column( 2 ).footer() ).html(
- ''+fTotal.toFixed(2) +' €'
- );
- $( api.column( 3 ).footer() ).html(
- ''+pTotal.toFixed(2) +' €'
- );
- $( api.column( 4 ).footer() ).html(
- ''+bTotal.toFixed(2) +' €'
- );
- //$( api.column( 4 ).footer() ).html(
- // ''+pageTotal.toFixed(2) +' €'
- //);
- // $( api.column( 3 ).footer() ).html(
- // ''+lTotal.toFixed(2) +' €'
- //);
- //$( api.column( 2 ).footer() ).html(
- // ''+hTotal.toFixed(2) +' €'
- //);
- }
- });
-
-// $('#tbl_accounting').on( 'search.dt', function () {
-// pconfig.filter = tblacc.api().search();
-// apppref.setpreference("pageconfig.accountingchild",pconfig);
-// } );
-
- $('#tbl_accounting').on( 'order.dt', function () {
- pconfig.order= tblacc.fnSettings().aaSorting;
- apppref.setpreference("pageconfig.accountingchild",pconfig);
-
- } );
-// if (pconfig.filter) {
-// tblacc.fnFilter(pconfig.filter);
-// }
- if (pconfig.order) {
-
- tblacc.fnSort(pconfig.order);
- }
-
-
-
-$('#tbl_accounting tbody').on( 'click', 'tr', function () {
- if ( $(this).hasClass('selected') ) {
- // $(this).removeClass('selected');
- }
- else {
- tblacc.$('tr.selected').removeClass('selected');
- $(this).addClass('selected');
- }
- } );
-}
-
-function set_accchild(){
- pconfig.accchild = $('#accchild').val();
- apppref.setpreference("pageconfig.accountingchild",pconfig);
- globelreq.send_request({
- page: 'accountingchild',
- module: 'accounting',
- data: null,
- header: 'Décompte par enfant'
- });
-}
-
-function load_childlist() {
-
- var chlst = appdb.dbquery("select pr.childuuid,COALESCE(ch.prename,'') || ' ' || COALESCE(ch.surname,'') || ' (' || COALESCE(ch.checkservicenumber,'') || ')' AS childname from childs ch left join presence pr on (ch.uuid=pr.childuuid) where pr.childuuid is not null group by ch.uuid order by childname");
- chlst = chlst.sqldata;
- for (c in chlst){
- $("#accchild").append('<option value="'+ chlst[c].childuuid+'">'+ chlst[c].childname +'</option>');
- }
-}
-
-
-function dlg_accounting(myuuid){
- $("#frmeditaccounting #action").val("upd");
- $("#head_invoice").html("Editer facture");
- $("#frmeditaccounting #childname").val($("#accchild option:selected").text());
-
- var acc1sql = "SELECT uuid,accmonth,childuuid,case when invoicedate is not null then strftime('%d.%m.%Y',invoicedate) else null end as invoicedate, case when payeddate is not null then strftime('%d.%m.%Y',payeddate) else null end as payeddate, payedamount, benefitamount,invoiceamount, reference, nocheckservice, case when reminderdate1 is not null then strftime('%d.%m.%Y',reminderdate1) else null end as reminderdate1, case when reminderdate2 is not null then strftime('%d.%m.%Y',reminderdate2) else null end as reminderdate2, case when reminderdate3 is not null then strftime('%d.%m.%Y',reminderdate3) else null end as reminderdate3,case when invoicefile is not null and invoicefile != '' then '"+ importpath.path + system.sep() +"' || invoicefile else null end as invoicefile,'upd' as action FROM accounting where uuid='" + myuuid +"';";
-
- var acc1data = appdb.dbquery(acc1sql);
-
- if (acc1data.sqldata.length == 0) {
-
- acc1sql = "SELECT '0' as uuid,"+ accmonth.substring(3) + "-" + accmonth.substring(0,2) +"-01' as accmonth,'"+ pconfig.accchild+"' as childuuid, null as invoicedate, null as payeddate, null as payedamount, null as invoiceamount,1 as ischeckservice, null as reference, null as reminderdate1, null as reminderdate2, null as reminderdate3,null as benefitamount ,null as invoicefile, 'ins' as action;";
- acc1data = appdb.dbquery(acc1sql);
- }
- acc1data = acc1data.sqldata[0];
- if (acc1data.nocheckservice == 1){
- $("#frmeditaccounting #nocheckservice").prop("checked",true);
- } else {
- $("#frmeditaccounting #nocheckservice").prop("checked",false);
- }
- for (var a in acc1data){
-
- if ($("#frmeditaccounting #" +a)) {
-
- $("#frmeditaccounting #"+a).val(acc1data[a]);
- }
- }
- $("#edit_accounting").modal('show');
-
-}
-
-function newinvoice(){
- if ($("#accchild").val() == ""){
- alert("Vous devez d'abort selectionner un enfant!");
- return;
- }
- $("#frmeditaccounting :input").each(function(){
- var input = $(this);
- input.val("");
- });
- $("#frmeditaccounting #nocheckservice").prop("checked",true);
- $("#frmeditaccounting #action").val("ins");
- $("#frmeditaccounting #uuid").val("0");
- $("#frmeditaccounting #childuuid").val($("#accchild").val());
- $("#head_invoice").html("Ajouter une facture");
-
-
- $("#frmeditaccounting #childname").val($("#accchild option:selected").text());
- $("#edit_accounting").modal('show');
-}
-
-function save_accounting(){
- var sql1 = new Array();
- var sql2 = new Array();
- // var cntnum = "01";
- var type = $("#frmeditaccounting #action").val();
- if (type == 'ins'){
- sql1.push('childuuid');
- sql2.push("'"+ pconfig.accchild +"'");
-
- }
-
- $("#frmeditaccounting :input").each(function(){
- var input = $(this);
- if (input.attr("id") ){
- if ((type == 'ins') && (input.attr("type") != 'hidden') && (input.attr("id") != 'accmonth') && (input.attr("id") != 'childname') && (input.attr("id") != 'ischeckservice')) {
-
- sql1.push('"' + input.attr("id") + '"');
- if (input.attr("type") == "file") {
- var newlocation= importpath.path + system.sep() + system.getFileName(input.val());
- if (!system.fileexists(importpath.path)){
- importpath.create(1,0755);
- }
- OS.File.copy(input.val(), newlocation);
- }
- var ival = input.val();
- if ((input.attr("id") == 'reference') && $("#frmeditaccounting #ischeckservice").is(":checked")){
- sql1.push("nocheckservice");
- sql2.push("'1'");
- }
- var ival = encodeparam(input.val(),input.attr('type'));
- sql2.push(ival);
- if (input.attr("id") == 'invoicedate'){
- sql1.push('"accmonth"');
-
- var newaccmonth = ival.replace(/'/g,"");
- // var cntx = appdb.dbquery("select count(accmonth)+1 as cnt from accounting where childuuid = '"+ pconfig.accchild +"' and accmonth between date('"+newaccmonth.substring(0,4) + "-" + newaccmonth.substring(5,7)+"-01') and date('"+newaccmonth.substring(0,4) + "-" + newaccmonth.substring(5,7)+"-01','+1 month','-1 day'); ");
- // cntnum = cntx.sqldata[0].cntx;
- // if (cntnum < 10){ cntnum = "0" + cntnum;}
- sql2.push('\'' + newaccmonth.substring(0,4) + "-" + newaccmonth.substring(5,7) +"-01'");
- }
- }else {
- if ((input.attr("type") != 'hidden') && (input.attr("id") != 'childname') && (input.attr("id") != 'ischeckservice')) {
- if (input.attr("type") == "file") {
- if (system.getDirectory(input.val()) != importpath.path) {
- var newlocation= importpath.path + system.sep() + system.getFileName(input.val());
- OS.File.copy(input.val(), newlocation);
- }
- }
- var ival = input.val();
- if ((input.attr("id") == 'reference') && $("#frmeditaccounting #ischeckservice").is(":checked")){
- sql2.push("nocheckservice='1'");
- }
- var ival = encodeparam(ival,input.attr('type'));
- sql2.push('"' + input.attr("id") +'"='+ ival);
- if (input.attr("id") == 'invoicedate'){
- var newaccmonth = ival.replace(/'/g,"");
- // var cntx = appdb.dbquery("select count(accmonth)+1 as cnt from accounting where childuuid = '"+ pconfig.accchild +"' and accmonth between date('"+newaccmonth.substring(0,4) + "-" + newaccmonth.substring(5,7)+"-01') and date('"+newaccmonth.substring(0,4) + "-" + newaccmonth.substring(5,7)+"-01','+1 month','-1 day'); ");
- // cntnum = cntx.sqldata[0].cntx;
- // if (cntnum < 10){ cntnum = "0" + cntnum;}
- sql2.push('"accmonth"=\'' + newaccmonth.substring(0,4) + "-" + newaccmonth.substring(5,7) +"-01'");
- }
-
- }
- }
- }
-
- });
- var xsql = "";
- if (type == 'upd') {
- xsql = "UPDATE accounting SET "+sql2.join(',')+" where \"uuid\"='" + $("#frmeditaccounting #uuid").val() +"';";
- }else {
- sql1.push("uuid");
- sql2.push("'" + appdb.generate_uuid() + "'");
- xsql = "INSERT INTO accounting ("+sql1.join(',')+") VALUES ("+sql2.join(',')+");";
- }
- //jsdump(xsql);
- appdb.dbexec(xsql);
- load_accounting_table();
- $("#frmeditaccounting #uuid").val("0");
- $("#edit_accounting").modal('hide');
- }
-
-function print_list(){
- globelreq.send_request({page:'preview2',data:{page: 'accountingchild'}});
-}
-
-function openfile(fi){
- var ddir = system.getDirectory(appdb.dbFile.path);
- var ff = system.openFile(ddir + system.sep() + 'imports' + system.sep() + crecheuuid +system.sep() + fi);
-}
-
-function set_accyear(){
- pconfig.accyear = $('#accyear').val();
- apppref.setpreference("pageconfig.accountingchild",pconfig);
- globelreq.send_request({
- page: 'accountingchild',
- module: 'accounting',
- data: null,
- header: 'Décompte par enfant'
- });
-}
-
-function set_selectyears() {
- var years = appdb.dbquery("select strftime('%Y',min(entrydate)) as minyear,strftime('%Y',max(leavedate)) as maxyear from childs;");
- var minyear = parseInt(years.sqldata[0].minyear);
- var maxyear = parseInt(years.sqldata[0].maxyear);
- for (var y=minyear;y<=maxyear;y++){
- var sel = "";
- if (y == pconfig.accyear) {
- sel=' selected="1" ';
- }
- $("#accyear").append("<option value=\""+y+"\""+sel+">"+y+"</option>");
- }
-
-}
-
-function confirm_delete_accounting(myuuid) {
- delacc.uuid = uuid;
- $('#confirm_delete_accounting').modal('show');
-}
-
-function delete_accounting() {
- var xsql = "DELETE FROM accounting where uuid='"+ delacc.uuid+"';";
-
- appdb.dbexec(xsql);
- load_accounting_table();
- delacc ={};
-
- $('#confirm_delete_accounting').modal('hide');
-}
-
-function load_column_selection() {
- var columns = 'weekdetails,monthtotalhourcosts,monthtotallunchcosts,monthtotalcosts,invoiced,payement,benefitamount';
- var head = getlabelswithkey(columns);
- var hidden_columns = [];
- //if (pconfig.hidden_columns) {
- // hidden_columns = JSON.parse(columns);
- //}
- for (var h=0;h<head.length;h++){
- $('#hidden_columns').append('<option value="'+ head[h].keyname +'" ><span >' +head[h].description+ '</span></option>');
- }
- $('#hidden_columns').multiselect({enableHTML: true,numberDisplayed:1,nonSelectedText:"Aucune",allSelectedText: 'Tous',nSelectedText: ' selections'});
- if (pconfig.hidden_columns) {
- //$('#hidden_columns' + objid).multiselect({enableHTML: true,numberDisplayed:3,nonSelectedText:"Tous",allSelectedText: 'Tous',nSelectedText: ' selections'});
- $('#hidden_columns').multiselect('select',pconfig.hidden_columns);
- }
-}
-
-function onhidecolumn(coltohide) {
- pconfig.hidden_columns = $('#hidden_columns').val();//(()?$('#' + objid).val().split(','):null);
- apppref.setpreference("pageconfig.accountingchild",pconfig);
- //dump(JSON.stringify(pconfig) + "\n");
- globelreq.send_request({
- page: 'accountingchild',
- module: 'accounting',
- data: null,
- header: 'Décompte par enfant'
- });
- //dump("Hide column " + coltohide + "\n");
-}
-
-// function check_accountingtable(){
-// var cols = appdb.dbquery("SELECT type, name,tbl_name,sql FROM sqlite_master where tbl_name='accounting';");
-// //jsdump(JSON.stringify(cols));
-// if (cols.sqldata[0].sql.indexOf("nocheckservice") == -1){
-// //jsdump("Install missing column! ALTER TABLE accounting add column nocheckservice integer");
-// appdb.dbexec("ALTER TABLE accounting add column nocheckservice integer;");
-// }
-// // else {
-// // jsdump("missing column found!");
-// // }
-// }
+++ /dev/null
-//Source-code licensed under EUPL v1.1 ( Copyright 2016 By DKS s.à r.l. - Kilian Saffran - Luxembourg )
-
-var pconfig = {};
-var winh= window.innerHeight -140;
-var tblacc = null;
-var gpaccchild = null;
-var crecheuuid = null;
-var importpath = null;
-//var lictype = apppref.getpreference("support.lictype");
-
-function initdata(){
- curcfg.loadconfig(apppref.getpreference("support.database.currentdb.num"));
- load_helpers();
- var configdata = apppref.getpreference("pageconfig.accountingopeninvoice");
-
- if (configdata != '') {
- pconfig = JSON.parse(configdata);
- }
- if (!pconfig.printlayout) {
- pconfig.printlayout = 'list';
- apppref.setpreference("pageconfig.accountingopeninvoice",pconfig);
- }
- var ccreche = appdb.dbquery("select uuid from creche LIMIT 1;");
- crecheuuid = ccreche.sqldata[0].uuid;
- importpath = FileUtils.File(curcfg.path.local + system.sep() +"imports" + system.sep() + crecheuuid);
-
- set_infoheader("");
- load_accounting_table();
-}
-
-function load_accounting_table(){
- var xsql = "DELETE from accounting where accmonth='' or accmonth is null;";
- appdb.dbexec(xsql);
- var accsql = "select strftime('%m.%Y',acc.accmonth) as calmonth,ch.clientnumber, " +
-"COALESCE(ch.prename,'') || ' ' || COALESCE(ch.surname,'') AS childname,ch.checkservicenumber, acc.reference as reference, " +
-"CASE WHEN acc.invoiceamount IS NOT NULL THEN printf(\"%.2f\",COALESCE(acc.invoiceamount,0.00)) || '€' || CASE WHEN acc.invoicedate IS NOT NULL THEN '<br/>(' || strftime('%d.%m.%Y',acc.invoicedate) || ')' || CASE WHEN acc.reminderdate1 IS NOT NULL THEN '<br/>R1:' || strftime('%d.%m.%Y',acc.reminderdate1) ELSE '' END || CASE WHEN acc.reminderdate2 IS NOT NULL THEN '<br/>R2:' || strftime('%d.%m.%Y',acc.reminderdate2) ELSE '' END || CASE WHEN acc.reminderdate3 IS NOT NULL THEN '<br/>R3:' || strftime('%d.%m.%Y',acc.reminderdate3) ELSE '' END ELSE '' END ELSE '' END AS invoiced, " +
-"CASE WHEN acc.payedamount IS NOT NULL THEN printf(\"%.2f\",COALESCE(acc.payedamount,0.00)) || '€' || CASE WHEN acc.payeddate IS NOT NULL THEN '<br/>(' || strftime('%d.%m.%Y',acc.payeddate) || ')' ELSE '' END ELSE '' END AS payement, " +
-"'<button type=\"button\" class=\"btn btn-primary\" onclick=\"dlg_accounting(''' || acc.uuid || ''');\" title=\"editer\"><span class=\"glyphicon glyphicon-pencil\"></span></button>' || case when acc.invoicefile is not null and acc.invoicefile != '' then '<button type=\"button\" class=\"btn btn-primary\" onclick=\"openfile(''' || acc.invoicefile || ''');\" title=\"editer\"><span class=\"glyphicon glyphicon-open\"></span></button>' else '' end AS act " +
-"from accounting acc join childs ch on (acc.childuuid=ch.uuid) " +
-"where (acc.invoiceamount is not null and acc.payedamount is null) or (acc.payedamount < acc.invoiceamount) order by acc.accmonth desc;";
-
-
- var accdata = appdb.dbquery(accsql);
- var headerdata = getlabels("calmonth,clientnumber,childname,checkservicenumber,reference,invoiced,payement,act");
-
-
- $("#tbl_accounting").html("");
-
- var hrow = headerdata;
- var tdclass= new Array();
- var tblheader = '<tr>';
-
- for (var h=0;h<hrow.length;h++){
- if (hrow[h] == 'act') {
- headerdata[h].class =headerdata[h].class + " action1btn";
- }
-
- tdclass.push(headerdata[h].class);
-
- tblheader += '<th class="' + headerdata[h].class +'">'+ headerdata[h].title+'</th>';
-
- }
- tblheader += '</tr>';
-
- $("#tbl_accounting").append("<thead>" + tblheader + "</thead>");
- $("#tbl_accounting").append("<tfoot>" + tblheader + "</tfoot>");
- $("#tbl_accounting").append("<tbody>");
-
- var curchld = "";
- for (var i in accdata.sqldata){
- var row = accdata.sqldata[i];
- var tr = '<tr><td>' + row.calmonth + '</td>';
- tr += '<td>' + row.clientnumber + '</td>';
- tr += '<td>' + row.childname + '</td>';
- tr += '<td>' + row.checkservicenumber + '</td>';
- tr += '<td>' + row.reference + '</td>';
- tr += '<td class="alignright">' + row.invoiced + '</td>';
- tr += '<td class="alignright">' + row.payement + '</td>';
- tr += '<td class="noprint">' + row.act + '</td></tr>';
- $("#tbl_accounting").append(tr);
- }
-
- $("#tbl_accounting").append("</tbody>");
- tblacc = $("#tbl_accounting").dataTable({
- "language": {
- "url": "../../web/js/locale/datatable_fr.json"
- },
- "paging": false,
- "ordering": true,
- "bAutoWidth": false,
- "scrollY": winh + "px",
- "scrollCollapse": true,
- "info": false,
- "filter": true,
- "destroy": true,
- "footerCallback": function ( row, data, start, end, display ) {
- var api = this.api(), data;
-
- var intVal = function ( i ) {
- return typeof i === 'string' ?
- i.substring(0,i.indexOf("\€"))*1 :
- typeof i === 'number' ?
- i : 0;
- };
-
- fTotal = api
- .column( 5, { page: 'current'} )
- .data()
- .reduce( function (a, b) {
- return intVal(a) + intVal(b);
- }, 0 );
- pTotal = api
- .column( 6, { page: 'current'} )
- .data()
- .reduce( function (a, b) {
- return intVal(a) + intVal(b);
- }, 0 );
-
- // Update footer
- $( api.column( 5 ).footer() ).html(
- ''+fTotal.toFixed(2) +' €'
- );
- $( api.column( 6 ).footer() ).html(
- ''+pTotal.toFixed(2) +' €'
- );
-
- }
- });
-
-// $('#tbl_accounting').on( 'search.dt', function () {
-// pconfig.filter = tblacc.api().search();
-// apppref.setpreference("pageconfig.accountingopeninvoice",pconfig);
-// } );
-
- $('#tbl_accounting').on( 'order.dt', function () {
- pconfig.order= tblacc.fnSettings().aaSorting;
- apppref.setpreference("pageconfig.accountingopeninvoice",pconfig);
-
- } );
-// if (pconfig.filter) {
-// tblacc.fnFilter(pconfig.filter);
-// }
- if (pconfig.order) {
-
- tblacc.fnSort(pconfig.order);
- }
-
-
-
-$('#tbl_accounting tbody').on( 'click', 'tr', function () {
- if ( $(this).hasClass('selected') ) {
-
- }
- else {
- tblacc.$('tr.selected').removeClass('selected');
- $(this).addClass('selected');
- }
- } );
-}
-
-
-function dlg_accounting(myuuid){
-
-
- var acc1sql = "SELECT acc.uuid as uuid,acc.accmonth,ch.prename || ' ' || ch.surname as childname,acc.nocheckservice,acc.childuuid,case when acc.invoicedate is not null then strftime('%d.%m.%Y',acc.invoicedate) else null end as invoicedate, case when acc.payeddate is not null then strftime('%d.%m.%Y',acc.payeddate) else null end as payeddate, acc.payedamount,acc.benefitamount, acc.invoiceamount, acc.reference, case when acc.reminderdate1 is not null then strftime('%d.%m.%Y',acc.reminderdate1) else null end as reminderdate1, case when acc.reminderdate2 is not null then strftime('%d.%m.%Y',acc.reminderdate2) else null end as reminderdate2, case when acc.reminderdate3 is not null then strftime('%d.%m.%Y',acc.reminderdate3) else null end as reminderdate3,case when acc.invoicefile is not null and acc.invoicefile != '' then '"+ importpath.path + system.sep() +"' || acc.invoicefile else null end as invoicefile,'upd' as action FROM accounting acc join childs ch on (acc.childuuid=ch.uuid) where acc.uuid='"+myuuid+"';";
-
- //jsdump("acc1sql");
- //jsdump(acc1sql);
- var acc1data = appdb.dbquery(acc1sql);
-
- if (!acc1data.sqldata) {
-
- return false;
- }
- acc1data = acc1data.sqldata[0];
-
- for (var a in acc1data){
- if (a == "nocheckservice"){
- if (acc1data[a] == 1){
- $("#frmeditaccounting #nocheckservice").prop("checked",true);
- } else {
- $("#frmeditaccounting #nocheckservice").prop("checked",false);
- }
- }
- if ($("#frmeditaccounting #" +a)) {
-
- $("#frmeditaccounting #"+a).val(acc1data[a]);
- }
- }
- $("#edit_accounting").modal('show');
-
-}
-
-function save_accounting(){
- var sql1 = new Array();
- var sql2 = new Array();
- // var cntnum = "01";
- var type = $("#frmeditaccounting #action").val();
- if (type == 'ins'){
- sql1.push('childuuid');
- sql2.push("'"+ pconfig.accchild +"'");
-
- }
-
- $("#frmeditaccounting :input").each(function(){
- var input = $(this);
- if (input.attr("id") ){
- if ((type == 'ins') && (input.attr("type") != 'hidden') && (input.attr("id") != 'accmonth') && (input.attr("id") != 'childname') && (input.attr("id") != 'ischeckservice')) {
-
- sql1.push('"' + input.attr("id") + '"');
- if (input.attr("type") == "file") {
- var newlocation= importpath.path + system.sep() + system.getFileName(input.val());
- if (!system.fileexists(importpath.path)){
- importpath.create(1,0755);
- }
- OS.File.copy(input.val(), newlocation);
- }
- var ival = input.val();
- if ((input.attr("id") == 'reference') && $("#frmeditaccounting #ischeckservice").is(":checked")){
- sql1.push("nocheckservice");
- sql2.push("'1'");
- }
- var ival = encodeparam(input.val(),input.attr('type'));
- sql2.push(ival);
- if (input.attr("id") == 'invoicedate'){
- sql1.push('"accmonth"');
-
- var newaccmonth = ival.replace(/'/g,"");
- // var cntx = appdb.dbquery("select count(accmonth)+1 as cnt from accounting where childuuid = '"+ pconfig.accchild +"' and accmonth between date('"+newaccmonth.substring(0,4) + "-" + newaccmonth.substring(5,7)+"-01') and date('"+newaccmonth.substring(0,4) + "-" + newaccmonth.substring(5,7)+"-01','+1 month','-1 day'); ");
- // cntnum = cntx.sqldata[0].cntx;
- // if (cntnum < 10){ cntnum = "0" + cntnum;}
- sql2.push('\'' + newaccmonth.substring(0,4) + "-" + newaccmonth.substring(5,7) +"-01'");
- }
- }else {
- if ((input.attr("type") != 'hidden') && (input.attr("id") != 'childname') && (input.attr("id") != 'ischeckservice')) {
- if (input.attr("type") == "file") {
- if (system.getDirectory(input.val()) != importpath.path) {
- var newlocation= importpath.path + system.sep() + system.getFileName(input.val());
- OS.File.copy(input.val(), newlocation);
- }
- }
- var ival = input.val();
- if ((input.attr("id") == 'reference') && $("#frmeditaccounting #ischeckservice").is(":checked")){
- sql2.push("nocheckservice='1'");
- }
- var ival = encodeparam(ival,input.attr('type'));
- sql2.push('"' + input.attr("id") +'"='+ ival);
- if (input.attr("id") == 'invoicedate'){
- var newaccmonth = ival.replace(/'/g,"");
- // var cntx = appdb.dbquery("select count(accmonth)+1 as cnt from accounting where childuuid = '"+ pconfig.accchild +"' and accmonth between date('"+newaccmonth.substring(0,4) + "-" + newaccmonth.substring(5,7)+"-01') and date('"+newaccmonth.substring(0,4) + "-" + newaccmonth.substring(5,7)+"-01','+1 month','-1 day'); ");
- // cntnum = cntx.sqldata[0].cntx;
- // if (cntnum < 10){ cntnum = "0" + cntnum;}
- sql2.push('"accmonth"=\'' + newaccmonth.substring(0,4) + "-" + newaccmonth.substring(5,7) +"-01'");
- }
-
- }
- }
- }
-
- });
- var xsql = "";
- if (type == 'upd') {
- xsql = "UPDATE accounting SET "+sql2.join(',')+" where \"uuid\"='" + $("#frmeditaccounting #uuid").val() +"';";
- }else {
- sql1.push("uuid");
- sql2.push("'" + appdb.generate_uuid() + "'");
- xsql = "INSERT INTO accounting ("+sql1.join(',')+") VALUES ("+sql2.join(',')+");";
- }
- //jsdump(xsql);
- appdb.dbexec(xsql);
- load_accounting_table();
- $("#frmeditaccounting #uuid").val("0");
- $("#edit_accounting").modal('hide');
-}
-
-function print_list(){
- globelreq.send_request({page:'preview2',data:{page: 'accountingopeninvoice'}});
-}
-
-function openfile(fi){
- var ddir = system.getDirectory(appdb.dbFile.path);
- var ff = system.openFile(ddir + system.sep() + 'imports' + system.sep() + crecheuuid +system.sep() + fi);
-}
-
+++ /dev/null
-//Source-code licensed under EUPL v1.1 ( Copyright 2016 By DKS s.à r.l. - Kilian Saffran - Luxembourg )
-
-var pconfig = {};
-var cdate = null;
-var initdate = new Date();
-initdate.setDate(1);
-var winh= window.innerHeight -120;
-var tblacc = null;
-var curchilduuid = '';
-var crecheuuid = null;
-var importpath = null;
-//var lictype = apppref.getpreference("support.lictype");
-//var amonth = ['','Janvier','Février','Mars','Avril','Mai','Juin','Juillet','Aôut','Septembre','Novembre','Décembre'];
-//var amonth = ['','Janv','Févr','Mars','Avril','Mai','Juin','Juil','Aôut','Sept','Nov','Déc'];
-var defamountcolors ={ "invoiced":"#003300","payed":"#660066","benefit":"#663300","openinvoices":"#cc0000","income":"#000000"};
-//"preview":"#ff6600","calculated":"#003366",
-var defamounttitles ={
- //"calculated":"calculées",
- "invoiced":"facturées",
- "payed":"payées",
- "benefit":"prestations",
- "openinvoices":"factures ouverts",
- "income":"revenu (facturées + prestations)"
- //"preview":"prévision"
- };
-
-function initdata(){
- load_helpers();
- var configdata = apppref.getpreference("pageconfig.accountingyear");
- if (configdata != '') {
- pconfig = JSON.parse(configdata);
- }
- if (!pconfig.printlayout) {
- pconfig.printlayout = 'list';
- apppref.setpreference("pageconfig.accountingyear",pconfig);
- }
- if (!pconfig.amountcolors) {
- pconfig.amountcolors = defamountcolors;
- }
- if (!pconfig.filteramount) {
- pconfig.filteramount = ["calculated","openinvoices","income"];
- }
- if ((!pconfig) || (!pconfig.accyear)){
- pconfig.accyear=new Date().toLocaleFormat("%Y");
- apppref.setpreference("pageconfig.accountingyear",pconfig);
- }
- //if (lictype != "free"){
- // $("#mnuacc").css({"position":"absolute","z-index":"1000"});
- //}
- set_selectyears();
- load_amount_selection("filter_amounts");
-
-
- set_infoheader( "Année " + pconfig.accyear);
- load_accounting_table();
-
-}
-
-function print_list(){
- globelreq.send_request({page:'preview2',data:{page: 'accounting'}});
-}
-
-function load_accounting_table(){
-
-
- var daterangesql = "select case when strftime('%Y',date(yeardaybegin)) == '"+pconfig.accyear+"' then yeardaybegin else strftime('%Y-%m-%d',date(date(yeardaybegin),'+7 days')) end as yeardaybegin,"+
- "strftime('%Y-%m-%d',date(date(yeardayend),'+6 days')) as yeardayend "+
- "from ( " +
- "select case when strftime('%w','"+pconfig.accyear+"-01-01') = '1' then strftime('%Y-%m-%d','"+pconfig.accyear+"-01-01') else strftime('%Y-%m-%d', date(date('"+pconfig.accyear+"-01-01','-7 days'),'weekday 1')) end as yeardaybegin, "+
- "case when strftime('%w','"+pconfig.accyear+"-12-31') = '1' then strftime('%Y-%m-%d','"+pconfig.accyear+"-12-31') else strftime('%Y-%m-%d', date(date('"+pconfig.accyear+"-12-31','-7 days'),'weekday 1')) end as yeardayend "+
- ");";
- var daterange = appdb.dbquery(daterangesql);
- daterange = daterange.sqldata[0];
- var ydaybegin = daterange.yeardaybegin;
- var ydayend = daterange.yeardayend;
-
- var accsql = "SELECT childname, CAST(substr(calmonth,1,2) as int) as calmonth, substr(calmonth,4) as calyear, ";
- //if ((pconfig.filteramount.indexOf("calculated") != -1) ){
- // accsql += "case when substr(calmonth,4) || substr(calmonth,1,2) <= strftime('%Y%m',date('now')) then printf(\"%.2f\",SUM(weektotalhourcosts + weektotallunchcosts)) else null end AS calculatedamount, ";
- //}
- //if ((pconfig.filteramount.indexOf("preview") != -1) ){
- // accsql += "case when substr(calmonth,4) || substr(calmonth,1,2) > strftime('%Y%m',date('now')) then printf(\"%.2f\",SUM(weektotalhourcosts + weektotallunchcosts)) else null end AS previewamount, ";
- //}
- if (pconfig.filteramount.indexOf("invoiced") != -1) {
- accsql += "case when invoiceamount is not null then printf(\"%.2f\",invoiceamount) else null end as invoicedamount, ";
- }
- if (pconfig.filteramount.indexOf("payed") != -1) {
- accsql += "case when payedamount is not null then printf(\"%.2f\",payedamount) else null end as payedamount, ";
- }
- if (pconfig.filteramount.indexOf("benefit") != -1) {
- accsql += "case when benefitamount is not null then printf(\"%.2f\",benefitamount) else null end as benefitamount, ";
- }
- if (pconfig.filteramount.indexOf("openinvoices") != -1) {
- accsql += "case when invoiceamount is not null and (payedamount is null or payedamount < invoiceamount) is not null then printf(\"%.2f\",invoiceamount - coalesce(payedamount,0.00)) else null end as openinvoicesamount, ";
- }
- if (pconfig.filteramount.indexOf("income") != -1) {
- accsql += "case when benefitamount is not null or invoiceamount is not null then printf(\"%.2f\",coalesce(benefitamount,0.00) + coalesce(invoiceamount,0.00)) else null end as incomeamount, ";
- }
-
-accsql += "null as nouse FROM ( SELECT childname, ttl.childuuid, calmonth, sumdurationcalweek * weekhourcosts AS weektotalhourcosts, sumlunchcalweek * weeklunchcosts AS weektotallunchcosts, acc.invoiceamount, acc.payedamount, benefitamount " +
-"FROM ( SELECT pch.childname, pch.childuuid, px.calweek, px.calmonth, px.sumdurationcalweek, px.sumlunchcalweek, " +
-
-"CASE WHEN px.sumdurationcalweek IS NOT NULL AND pch.checkservicenumber IS NOT NULL THEN ( SELECT coalesce(wc0.costsperhour,0.00) FROM costs wc0 WHERE wc0.startdate < date('"+ydaybegin+"','+' || caldays || ' days') and wc0.weeklyhourslimit <= px.sumdurationcalweek ORDER BY wc0.startdate DESC,wc0.weeklyhourslimit DESC LIMIT 1 ) WHEN px.sumdurationcalweek IS NOT NULL AND pch.checkservicenumber IS NULL THEN ( SELECT coalesce(wc0.costperhourfallback,0.00) FROM costs wc0 WHERE wc0.startdate < date('"+ydaybegin+"','+' || caldays || ' days') and wc0.weeklyhourslimit <= px.sumdurationcalweek ORDER BY wc0.startdate DESC,wc0.weeklyhourslimit DESC LIMIT 1 ) ELSE NULL END AS weekhourcosts,"+
-
-"CASE WHEN px.sumlunchcalweek IS NOT NULL THEN ( SELECT coalesce(wc0.dailylunchcosts,0.00) FROM costs wc0 WHERE wc0.startdate < date('"+ydaybegin+"','+' || caldays || ' days') and wc0.weeklyhourslimit <= px.sumdurationcalweek ORDER BY wc0.startdate DESC,wc0.weeklyhourslimit DESC LIMIT 1) ELSE NULL END AS weeklunchcosts " +
-
-"FROM ( SELECT COALESCE(ch.prename,'') || ' ' || COALESCE(ch.surname,'') || '<br>(' || COALESCE(ch.checkservicenumber,'') || ')' AS childname, ch.uuid AS childuuid,ch.checkservicenumber FROM childs ch JOIN planning pl ON ( ch.uuid=pl.childuuid) ) pch " +
-"LEFT JOIN ( SELECT childuuid, calweek,case when strftime('%w',date(calyear ||'-01-01')) in ('1','2','3','4') then (cast(calweek as int)*7)-7 else (cast(calweek as int)*7) end as caldays, calmonth, sumlunchcalweek, " +
-"COALESCE(SUM(monduration + tueduration + wedduration + thuduration + friduration),0.0) AS sumdurationcalweek " +
-"FROM ( SELECT childuuid, daydate,calmonth,calyear, " +
-"CASE WHEN strftime('%w',DATE(calyear ||'-01-01')) IN ('1', '2', '3', '4') THEN CASE WHEN calweek < '10' THEN '0' ELSE '' END || CAST(calweek AS INT)+1 ELSE calweek END AS calweek, " +
-"MAX(monlunch) + MAX(tuelunch) + MAX(wedlunch) + MAX(thulunch) + MAX(frilunch) AS sumlunchcalweek, " +
-"MAX(monduration) + MAX(monduration2) AS monduration, " +
-"MAX(tueduration) + MAX(tueduration2) AS tueduration, " +
-"MAX(wedduration) + MAX(wedduration2) AS wedduration, " +
-"MAX(thuduration) + MAX(thuduration2) AS thuduration, " +
-"MAX(friduration) + MAX(friduration2) AS friduration " +
-"FROM ( SELECT xx.childuuid, xx.daydate, strftime('%Y',xx.daydate) AS calyear, " +
-"CASE WHEN strftime('%w',xx.daydate)='0' THEN strftime('%W',DATE(xx.daydate,'-6 days')) ELSE strftime('%W',DATE(DATE(xx.daydate),'-' || strftime('%w',DATE(xx.daydate)) || ' days', '+1 day')) END AS calweek, " +
-"CASE WHEN strftime('%w',xx.daydate)='0' THEN strftime('%m.%Y',DATE(xx.daydate,'-6 days')) ELSE strftime('%m.%Y',DATE(DATE(xx.daydate),'-' || strftime('%w',DATE(xx.daydate)) || ' days', '+1 day')) END AS calmonth, " +
-"CASE WHEN lunch=1 AND status IN (1,5) AND strftime('%w',daydate) = '1' THEN 1 ELSE 0 END AS monlunch, " +
-"CASE WHEN lunch=1 AND status IN (1,5) AND strftime('%w',daydate) = '2' THEN 1 ELSE 0 END AS tuelunch, " +
-"CASE WHEN lunch=1 AND status IN (1,5) AND strftime('%w',daydate) = '3' THEN 1 ELSE 0 END AS wedlunch, " +
-"CASE WHEN lunch=1 AND status IN (1,5) AND strftime('%w',daydate) = '4' THEN 1 ELSE 0 END AS thulunch, " +
-"CASE WHEN lunch=1 AND status IN (1,5) AND strftime('%w',daydate) = '5' THEN 1 ELSE 0 END AS frilunch, " +
-"CASE WHEN xx.status IS NOT NULL AND strftime('%w',xx.daydate) = '1' AND xx.daydate BETWEEN xx.datebegin AND xx.dateend THEN CAST(( (( CAST(SUBSTR(xx.montimeend,1,2) AS INT) *3600)+( CAST(SUBSTR(xx.montimeend,4,2) AS INT) *60))- ((CAST(SUBSTR(xx.montimebegin,1,2) AS INT) *3600)+( CAST(SUBSTR(xx.montimebegin,4, 2) AS INT) *60)) ) / 3600 AS REAL) ELSE 0.0 END AS monduration, " +
-"CASE WHEN xx.status IS NOT NULL AND strftime('%w',xx.daydate) = '2' AND xx.daydate BETWEEN xx.datebegin AND xx.dateend THEN CAST(( (( CAST(SUBSTR(xx.tuetimeend,1,2) AS INT) *3600)+( CAST(SUBSTR(xx.tuetimeend,4,2) AS INT) *60))- ((CAST(SUBSTR(xx.tuetimebegin,1,2) AS INT) *3600)+( CAST(SUBSTR(xx.tuetimebegin,4, 2) AS INT) *60)) ) / 3600 AS REAL) ELSE 0.0 END AS tueduration, " +
-"CASE WHEN xx.status IS NOT NULL AND strftime('%w',xx.daydate) = '3' AND xx.daydate BETWEEN xx.datebegin AND xx.dateend THEN CAST(( (( CAST(SUBSTR(xx.wedtimeend,1,2) AS INT) *3600)+( CAST(SUBSTR(xx.wedtimeend,4,2) AS INT) *60))- ((CAST(SUBSTR(xx.wedtimebegin,1,2) AS INT) *3600)+( CAST(SUBSTR(xx.wedtimebegin,4, 2) AS INT) *60)) ) / 3600 AS REAL) ELSE 0.0 END AS wedduration, " +
-"CASE WHEN xx.status IS NOT NULL AND strftime('%w',xx.daydate) = '4' AND xx.daydate BETWEEN xx.datebegin AND xx.dateend THEN CAST(( (( CAST(SUBSTR(xx.thutimeend,1,2) AS INT) *3600)+( CAST(SUBSTR(xx.thutimeend,4,2) AS INT) *60))- ((CAST(SUBSTR(xx.thutimebegin,1,2) AS INT) *3600)+( CAST(SUBSTR(xx.thutimebegin,4, 2) AS INT) *60)) ) / 3600 AS REAL) ELSE 0.0 END AS thuduration, " +
-"CASE WHEN xx.status IS NOT NULL AND strftime('%w',xx.daydate) = '5' AND xx.daydate BETWEEN xx.datebegin AND xx.dateend THEN CAST(( (( CAST(SUBSTR(xx.fritimeend,1,2) AS INT) *3600)+( CAST(SUBSTR(xx.fritimeend,4,2) AS INT) *60))- ((CAST(SUBSTR(xx.fritimebegin,1,2) AS INT) *3600)+( CAST(SUBSTR(xx.fritimebegin,4, 2) AS INT) *60)) ) / 3600 AS REAL) ELSE 0.0 END AS friduration, " +
-"CASE WHEN xx.status IS NOT NULL AND strftime('%w',xx.daydate) = '1' AND xx.daydate BETWEEN xx.datebegin AND xx.dateend AND xx.montimebegin2 IS NOT NULL AND xx.montimeend2 IS NOT NULL THEN CAST(( (( CAST(SUBSTR(xx.montimeend2,1,2) AS INT) *3600)+( CAST(SUBSTR(xx.montimeend2,4,2) AS INT) *60))- ((CAST(SUBSTR(xx.montimebegin2,1 ,2) AS INT) *3600)+( CAST(SUBSTR (xx.montimebegin2,4,2) AS INT) *60)) ) / 3600 AS REAL) ELSE 0.0 END AS monduration2, " +
-"CASE WHEN xx.status IS NOT NULL AND strftime('%w',xx.daydate) = '1' AND xx.daydate BETWEEN xx.datebegin AND xx.dateend AND xx.tuetimebegin2 IS NOT NULL AND xx.tuetimeend2 IS NOT NULL THEN CAST(( (( CAST(SUBSTR(xx.tuetimeend2,1,2) AS INT) *3600)+( CAST(SUBSTR(xx.tuetimeend2,4,2) AS INT) *60))- ((CAST(SUBSTR(xx.tuetimebegin2,1 ,2) AS INT) *3600)+( CAST(SUBSTR (xx.tuetimebegin2,4,2) AS INT) *60)) ) / 3600 AS REAL) ELSE 0.0 END AS tueduration2, " +
-"CASE WHEN xx.status IS NOT NULL AND strftime('%w',xx.daydate) = '1' AND xx.daydate BETWEEN xx.datebegin AND xx.dateend AND xx.wedtimebegin2 IS NOT NULL AND xx.wedtimeend2 IS NOT NULL THEN CAST(( (( CAST(SUBSTR(xx.wedtimeend2,1,2) AS INT) *3600)+( CAST(SUBSTR(xx.wedtimeend2,4,2) AS INT) *60))- ((CAST(SUBSTR(xx.wedtimebegin2,1 ,2) AS INT) *3600)+( CAST(SUBSTR (xx.wedtimebegin2,4,2) AS INT) *60)) ) / 3600 AS REAL) ELSE 0.0 END AS wedduration2, " +
-"CASE WHEN xx.status IS NOT NULL AND strftime('%w',xx.daydate) = '1' AND xx.daydate BETWEEN xx.datebegin AND xx.dateend AND xx.thutimebegin2 IS NOT NULL AND xx.thutimeend2 IS NOT NULL THEN CAST(( (( CAST(SUBSTR(xx.thutimeend2,1,2) AS INT) *3600)+( CAST(SUBSTR(xx.thutimeend2,4,2) AS INT) *60))- ((CAST(SUBSTR(xx.thutimebegin2,1 ,2) AS INT) *3600)+( CAST(SUBSTR (xx.thutimebegin2,4,2) AS INT) *60)) ) / 3600 AS REAL) ELSE 0.0 END AS thuduration2, " +
-"CASE WHEN xx.status IS NOT NULL AND strftime('%w',xx.daydate) = '1' AND xx.daydate BETWEEN xx.datebegin AND xx.dateend AND xx.fritimebegin2 IS NOT NULL AND xx.fritimeend2 IS NOT NULL THEN CAST(( (( CAST(SUBSTR(xx.fritimeend2,1,2) AS INT) *3600)+( CAST(SUBSTR(xx.fritimeend2,4,2) AS INT) *60))- ((CAST(SUBSTR(xx.fritimebegin2,1 ,2) AS INT) *3600)+( CAST(SUBSTR (xx.fritimebegin2,4,2) AS INT) *60)) ) / 3600 AS REAL) ELSE 0.0 END AS friduration2, " +
-"NULL AS nouse FROM ( " +
-"SELECT vacancydate AS daydate, CAST('0' AS BOOLEAN) AS lunch, 1 AS status, pl.* FROM vacancy va LEFT JOIN planning pl ON ( va.vacancydate BETWEEN pl.datebegin AND pl.dateend) WHERE va.vacancydateto is null and va.vacancydate BETWEEN '"+ydaybegin+"' AND '"+ydayend+"' AND strftime('%w',va.vacancydate) NOT IN ('0', '6') GROUP BY va.vacancydate, pl.childuuid " +
-"UNION " +
-"SELECT pr.daydate, pr.lunch, pr.status, pl.* FROM presence" +
-" pr JOIN planning pl ON ( pr.childuuid=pl.childuuid) WHERE pr.daydate BETWEEN '"+ydaybegin+"' AND ";
-
-if (pconfig.filteramount.indexOf("preview") != -1) {
- accsql += "(select max(zz.daydate) from presence zz where strftime('%Y-%m',zz.daydate) = strftime('%Y-%m',date('now')))"
- accsql += " UNION " +
-"SELECT tmp.daydate, CASE WHEN pa.monlunch='1' AND strftime('%w',tmp.daydate) = '1' THEN 1 " +
-"WHEN pa.tuelunch='1' AND strftime('%w',tmp.daydate) = '2' THEN 1 " +
-"WHEN pa.wedlunch='1' AND strftime('%w',tmp.daydate) = '3' THEN 1 " +
-"WHEN pa.thulunch='1' AND strftime('%w',tmp.daydate) = '4' THEN 1 " +
-"WHEN pa.frilunch='1' AND strftime('%w',tmp.daydate) = '5' THEN 1 else 0 end as lunch, 1 as status , pa.* " +
-"FROM (select daydate from ( ";
- accsql += getsqldaterange(ydaybegin,ydayend);
- accsql += ") dd where dd.daydate not in (select vacancydate from vacancy where vacancydateto is null) and dd.daydate > (select max(yy.daydate) from presence yy where strftime('%Y-%m',yy.daydate) = strftime('%Y-%m',date('now')) ) and strftime('%w',dd.daydate) not in ('0','6') ) tmp " +
-"LEFT JOIN planning pa ON ( tmp.daydate BETWEEN pa.datebegin AND pa.dateend) ";
-
-}else {
- accsql += "'"+ydayend+"'";
-}
-accsql += ") xx " +
-"WHERE xx.daydate BETWEEN '"+ydaybegin+"' AND '"+ydayend+"' ";
-if (pconfig.filteramount.indexOf("preview") == -1) {
- accsql += " and strftime('%Y-%m',xx.daydate) <= strftime('%Y-%m',date('now')) ";
-}
-accsql += ") GROUP BY childuuid,calweek) GROUP BY childuuid,calweek) px " +
-"ON ( pch.childuuid=px.childuuid) GROUP BY px.childuuid,px.calweek ) ttl " +
-"LEFT JOIN accounting acc ON ( ttl.childuuid = acc.childuuid AND ttl.calmonth=strftime('%m.%Y',acc.accmonth)) WHERE calweek IS NOT NULL) " +
-"GROUP BY childname,calmonth ORDER BY childname,calmonth;";
-
- var accdata = appdb.dbquery(accsql);
- //dump(accsql + "\n");
- var headerdata = getlabels("childname,jan,feb,mar,apr,may,jun,jul,aug,sep,oct,nov,dec,total");
- $("#tbl_accounting").html("");
-
- var hrow = headerdata;
- var tdclass= new Array();
- var tblheader = '<tr>';
-
- for (var h=0;h<hrow.length;h++){
- tdclass.push(headerdata[h].class);
- tblheader += '<th class="' + headerdata[h].class +'">'+ headerdata[h].title+'</th>';
- }
- tblheader += '</tr>';
-
- $("#tbl_accounting").append("<thead>" + tblheader + "</thead>");
- $("#tbl_accounting").append("<tfoot>" + tblheader + "</tfoot>");
- $("#tbl_accounting").append("<tbody>");
-
- var curchild = "";
-
- var tbody = "";
- var trcells = [];
- var colmonthsum = new Array(12);
- for (var i in accdata.sqldata){
- var row = accdata.sqldata[i];
- if (curchild != row.childname) {
- if (i != 0) {
- var cells = [];
-
- for (var t in trcells){
- if (trcells.length > 0) {
- if (t == 12) {
- for (var s in trcells[t]){
- if (trcells[t][s] == 0) {
- trcells[t][s] = '';
- } else {
- trcells[t][s] = '<span style="color:' + defamountcolors[pconfig.filteramount[s]] + ';">' + trcells[t][s].toFixed(2) + "</span>";
- }
- }
- }
- cells[t] = trcells[t].join("<br/>");
- }else {
- cells[t] = "";
- }
- }
-
- tbody += "<td class=\"alignright\">" + cells.join("</td><td class=\"alignright\">") +'</td></tr>';
- }
- tbody += '<tr><td>' + row.childname + '</td>';
- trcells = [[],[],[],[],[],[],[],[],[],[],[],[],[]];
-
- }
- var cmon = parseInt(row.calmonth)-1;
- for (var x in pconfig.filteramount){
-
- trcells[cmon][x] = ((row[pconfig.filteramount[x] + "amount"] != '')?'<span style="color:' + defamountcolors[pconfig.filteramount[x]] + ';">' +row[pconfig.filteramount[x] + "amount"] + "</span>":"");
- if (!trcells[12][x]) {
- trcells[12][x] = 0;
- }
- trcells[12][x] = trcells[12][x] + ((row[pconfig.filteramount[x] + "amount"] != '')?parseFloat(row[pconfig.filteramount[x] + "amount"]):0.00);
- }
-
- curchild = row.childname;
- }
- var cells = [];
-
- for (var t in trcells){
- if (trcells.length > 0) {
- if (t == 12) {
- for (var s in trcells[t]){
- if (trcells[t][s] == 0) {
- trcells[t][s] = '';
- } else {
- trcells[t][s] = '<span style="color:' + defamountcolors[pconfig.filteramount[s]] + ';">' + trcells[t][s].toFixed(2) + "</span>";
- }
- }
- }
- cells[t] = trcells[t].join("<br/>");
- }else {
- cells[t] = "";
- }
- }
-
- tbody += "<td class=\"alignright\">" + cells.join("</td><td class=\"alignright\">") +'</td></tr>';
- $("#tbl_accounting").append(tbody);
- $("#tbl_accounting").append("</tbody>");
-
- winh = window.innerHeight -130 - ((pconfig.filteramount.length == 0)? 80:pconfig.filteramount.length*16);
- tblacc = $("#tbl_accounting").dataTable({
- "language": {
- "url": "../../web/js/locale/datatable_fr.json"
- },
- "paging": false,
- "ordering": true,
- "bAutoWidth": false,
- "scrollY": winh + "px",
- "scrollCollapse": true,
- "info": false,
- "filter": true,
- "destroy": true,
- "footerCallback": function ( row, data, start, end, display ) {
- var api = this.api(), data;
-
- var formatfootercell = function(r){
- var afil = 0;
- var dspa = new Array();
- //dump(r + "\n");
- for (var x=0;x<r.length;x++){
-
- if (r[x] != 0) {
-
- dspa.push('<span style="color:' + defamountcolors[pconfig.filteramount[x]] + ';">' + r[x].toFixed(2)+ "</span>");
- afil++;
- }
- }
- return dspa.join('<br/>');
- }
- //var emptarray
- var nospan = /\d+\.\d+/g;
- var intVal = function ( i ) {
- var spl = [];
-
- if ((!i) || (i == '') ) {
- for (var x = 0;x<pconfig.filteramount.length;x++){
- spl.push(0);
- }
- }
- if (typeof i === 'string') {
-
- i= i.replace(/<span style="color:#\w+;">/g,'').replace(/<span>/g,'');
- spl = i.split("<br>");
-
- if (!spl) {
- spl =new Array();
- }
- for (var x = spl.length;x<pconfig.filteramount.length;x++){
- spl.push(0);
- }
- for (var x in spl){
- if(spl[x] == ''){
- spl[x] = 0;
- }
- }
- }
- if (typeof i === 'object') {
- spl = i;
- }
-
- return spl;
- };
- retvals = function(c,d){
- var nr = [];
-
- for (var s=0;s<pconfig.filteramount.length;s++){
- if (!c[s]) { c[s] = 0;}
- if (!d[s]) { d[s] = 0;}
- nr.push(parseFloat(c[s]) + parseFloat(d[s]));
- }
-
- return nr;
- }
- jantotal = api.column( 1, { page: 'current'} ).data().reduce( function (a, b) {
-
- return retvals(intVal(a),intVal(b));
- }, 0 );
- febtotal = api.column( 2, { page: 'current'} ).data().reduce( function (a, b) {
- return retvals(intVal(a),intVal(b));
- }, 0 );
- martotal = api.column( 3, { page: 'current'} ).data().reduce( function (a, b) {
- return retvals(intVal(a),intVal(b));
- }, 0 );
- aprtotal = api.column( 4, { page: 'current'} ).data().reduce( function (a, b) {
- return retvals(intVal(a),intVal(b));
- }, 0 );
- maytotal = api.column( 5, { page: 'current'} ).data().reduce( function (a, b) {
- return retvals(intVal(a),intVal(b));
- }, 0 );
- juntotal = api.column( 6, { page: 'current'} ).data().reduce( function (a, b) {
- return retvals(intVal(a),intVal(b));
- }, 0 );
- jultotal = api.column( 7, { page: 'current'} ).data().reduce( function (a, b) {
- return retvals(intVal(a),intVal(b));
- }, 0 );
- augtotal = api.column( 8, { page: 'current'} ).data().reduce( function (a, b) {
- return retvals(intVal(a),intVal(b));
- }, 0 );
- septotal = api.column( 9, { page: 'current'} ).data().reduce( function (a, b) {
- return retvals(intVal(a),intVal(b));
- }, 0 );
- octtotal = api.column( 10, { page: 'current'} ).data().reduce( function (a, b) {
-
- return retvals(intVal(a),intVal(b));
- }, 0 );
- novtotal = api.column( 11, { page: 'current'} ).data().reduce( function (a, b) {
- return retvals(intVal(a),intVal(b));
- }, 0 );
- dectotal = api.column( 12, { page: 'current'} ).data().reduce( function (a, b) {
- return retvals(intVal(a),intVal(b));
- }, 0 );
- alltotal = api.column( 13, { page: 'current'} ).data().reduce( function (a, b) {
- return retvals(intVal(a),intVal(b));
- }, 0 );
- $( api.column( 0).footer() ).html("Totaux");
- $( api.column( 1 ).footer() ).html(formatfootercell(jantotal));
- $( api.column( 1 ).footer() ).addClass("alignright aligntop");
- $( api.column( 2 ).footer() ).html(formatfootercell(febtotal));
- $( api.column( 2 ).footer() ).addClass("alignright aligntop");
- $( api.column( 3 ).footer() ).html(formatfootercell(martotal));
- $( api.column( 3 ).footer() ).addClass("alignright aligntop");
- $( api.column( 4 ).footer() ).html(formatfootercell(aprtotal));
- $( api.column( 4 ).footer() ).addClass("alignright aligntop");
- $( api.column( 5 ).footer() ).html(formatfootercell(maytotal));
- $( api.column( 5 ).footer() ).addClass("alignright aligntop");
- $( api.column( 6 ).footer() ).html(formatfootercell(juntotal));
- $( api.column( 6 ).footer() ).addClass("alignright aligntop");
- $( api.column( 7 ).footer() ).html(formatfootercell(jultotal));
- $( api.column( 7 ).footer() ).addClass("alignright aligntop");
- $( api.column( 8 ).footer() ).html(formatfootercell(augtotal));
- $( api.column( 8 ).footer() ).addClass("alignright aligntop");
- $( api.column( 9 ).footer() ).html(formatfootercell(septotal));
- $( api.column( 9 ).footer() ).addClass("alignright aligntop");
- $( api.column( 10 ).footer() ).html(formatfootercell(octtotal));
- $( api.column( 10 ).footer() ).addClass("alignright aligntop");
- $( api.column( 11 ).footer() ).html(formatfootercell(novtotal));
- $( api.column( 11 ).footer() ).addClass("alignright aligntop");
- $( api.column( 12 ).footer() ).html(formatfootercell(dectotal));
- $( api.column( 12 ).footer() ).addClass("alignright aligntop");
- $( api.column( 13 ).footer() ).html(formatfootercell(alltotal));
- $( api.column( 13 ).footer() ).addClass("alignright aligntop");
- }
- });
-// $('#tbl_accounting').on( 'search.dt', function () {
-//
-// pconfig.filter = tblacc.api().search();
-//
-// apppref.setpreference("pageconfig.accountingyear",pconfig);
-// } );
-
- $('#tbl_accounting').on( 'order.dt', function () {
- pconfig.order= tblacc.fnSettings().aaSorting;
-
- apppref.setpreference("pageconfig.accountingyear",pconfig);
-
- } );
-
-// if (pconfig.filter) {
-// tblacc.fnFilter(pconfig.filter);
-// }
- if (pconfig.order) {
-
- tblacc.fnSort(pconfig.order);
- }
-
-
-
-$('#tbl_accounting tbody').on( 'click', 'tr', function () {
- if ( $(this).hasClass('selected') ) {
-
- }
- else {
- tblacc.$('tr.selected').removeClass('selected');
- $(this).addClass('selected');
- }
- } );
-
-}
-
-function getsqldaterange(ydb,yde) {
- var dtydb = new Date(ydb);
-
- var dtyde = new Date(yde);
-
- var sday = new Array();
- for (var cdate=dtydb;cdate<=dtyde;cdate.setDate(cdate.getDate() +1)){
- if ((cdate.getDay() != 0) && (cdate.getDay() != 6)){
- sday.push("select date('" + cdate.toLocaleFormat('%Y-%m-%d') +"') as daydate");
- }
- }
-
- return sday.join(" UNION ");
-}
-
-function set_selectyears() {
- var years = appdb.dbquery("select strftime('%Y',min(entrydate)) as minyear,strftime('%Y',max(leavedate)) as maxyear from childs;");
- var minyear = parseInt(years.sqldata[0].minyear);
- var maxyear = parseInt(years.sqldata[0].maxyear);
- for (var y=minyear;y<=maxyear;y++){
- var sel = "";
- if (y == pconfig.accyear) {
- sel=' selected="1" ';
- }
- $("#accyear").append("<option value=\""+y+"\""+sel+">"+y+"</option>");
- }
-
-}
-
-function load_amount_selection(objid) {
- for (var s in defamounttitles){
- $('#' + objid).append('<option value="'+ s +'"><span style="color: '+defamountcolors[s]+';" >' +defamounttitles[s]+ '</span></option>');
- }
-
- if (pconfig.filteramount) {
- $('#' + objid).multiselect({enableHTML: true,numberDisplayed:8,nonSelectedText:"Tous",allSelectedText: 'Tous'});
- $('#' + objid).multiselect('select',pconfig.filteramount);
- } else {
- $('#' + objid).multiselect({enableHTML: true,numberDisplayed:8,nonSelectedText:"Tous",allSelectedText: 'Tous'});
- }
-}
-
-function onselamount() {
- if ($('#filter_amounts').val()) {
- pconfig.filteramount = $('#filter_amounts').val();
- }else {
- pconfig.filteramount = ["invoiced","payed","openinvoices","income","benefit"];
- }
- apppref.setpreference("pageconfig.accountingyear",pconfig);
- load_accounting_table();
-}
-
-function set_accyear(){
- pconfig.accyear = $('#accyear').val();
- apppref.setpreference("pageconfig.accountingyear",pconfig);
- globelreq.send_request({
- page: 'accountingyear',
- module: 'accounting',
- data: null,
- header: 'Bilan annuelle'
- });
-}
-
-
-
-
+++ /dev/null
-function initdata(){
- curcfg.loadconfig(apppref.getpreference("support.database.currentdb.num"));
- load_helpers();
-// //var importpath = {path : apppref.curcfg.dbpath + '/' +apppref.curcfg.db.substring(0,-6) +'/import/' };
-//
-//// pconfig.printlayout = 'list';
-// var ccreche = appdb.dbquery("select uuid from creche LIMIT 1;");
-// crecheuuid = ccreche.sqldata[0].uuid;
-//
-//
-// if ((apppref.curcfg.pageconfig.data) && (apppref.curcfg.pageconfig.data.accmonth)) {
-//
-// initdate = new Date(apppref.curcfg.pageconfig.data.accmonth);
-//
-// }
-// $("#accmonth").val(formatMonthYearDate(initdate));
-// apppref.setpreference("data","accmonth",formatisodate(initdate));
-// cdate = initdate.toISOString().substring(0,10);
-//
-// load_accounting_table();
-// var bfile = appdb.dbquery("select benefitfile from accounting where accmonth = date('"+apppref.curcfg.pageconfig.data.accmonth+"') group by benefitfile LIMIT 1;");
-//
-// if ((bfile.sqldata) && (bfile.sqldata.length == 1)) {
-// $('#mnuacc').append("<button type=\"button\" class=\"btn btn-primary\" onclick=\"openfile('"+ bfile.sqldata[0].benefitfile +"');\" title=\"editer\"><span class=\"glyphicon glyphicon-open\"></span> fichier des prestations</button>");
-// }
-// $("#accmonth").on("change", function (e) {
-// set_accmonth();
-// });
-
-}
-
-function loadinvoicepdf(){
- var lastdir = apppref.getpreference("support.lastfiledir");
- var nsIFilePicker = Components.interfaces.nsIFilePicker;
- var fp = Components.classes["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);
- fp.init(window, "selectionner fichier PDF", nsIFilePicker.modeOpen);
- fp.appendFilter("PDF", "*.pdf");
- if (lastdir != '') {
- var nsILocalFile= Components.interfaces.nsILocalFile;
- var f = Components.classes["@mozilla.org/file/local;1"].createInstance(nsILocalFile);
- f.initWithPath(lastdir);
- fp.displayDirectory = f;
- }
- var res = fp.show();
- if (res != nsIFilePicker.returnCancel) {
- var pdffile = fp.file.path;
- dump("PDF File Selected: " + pdffile + "\n");
- apppref.setpreference("support.lastfiledir",system.getDirectory(pdffile));
- $("#importfileinvoice").val(pdffile);
- }
-}
-
-function loadinvoicexml(){
- var lastdir = apppref.getpreference("support.lastfiledir");
- var nsIFilePicker = Components.interfaces.nsIFilePicker;
- var fp = Components.classes["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);
- fp.init(window, "selectionner fichier XML", nsIFilePicker.modeOpen);
- fp.appendFilter("XML", "*.xml");
- if (lastdir != '') {
- var nsILocalFile= Components.interfaces.nsILocalFile;
- var f = Components.classes["@mozilla.org/file/local;1"].createInstance(nsILocalFile);
- f.initWithPath(lastdir);
- fp.displayDirectory = f;
- }
- var res = fp.show();
- if (res != nsIFilePicker.returnCancel) {
- var xmlfile = fp.file.path;
- dump("XML File Selected: " + xmlfile + "\n");
- apppref.setpreference("support.lastfiledir",system.getDirectory(xmlfile));
- $('#importfilexml').val(xmlfile);
- }
-}
-
-function importfiles(){
- $("#btnimportfiles").hide();
- $("#importresult").hide();
- $("#importprogress").show();
-
- OS.File.remove(system.profiledir+ system.sep() + 'lastimport.json',{ignoreAbsent:true});
- var cname = appdb.dbquery("select uuid from creche LIMIT 1;");
- cruuid = cname.sqldata[0].uuid;
- dump(curcfg.path.local + system.sep() +"imports" + system.sep() + cruuid + "\n");
- var importpath = FileUtils.File(curcfg.path.local + system.sep() +"imports" + system.sep() + cruuid);
- var args = ["-db",'"' + appdb.dbFile.path + '"',"-p",'"' +$("#importfileinvoice").val() + '"',"-o",'"' + importpath.path + '"',"-t",'"' + system.toolsdir() + '"',"-l", '"' + system.profiledir()+ system.sep() + 'lastimport.json'];
- if ($('#importfilexml').val() != ""){
- args.push("-x");
- args.push('"' + $('#importfilexml').val() + '"');
- }
-
- var binpdf = system.toolsdir() + system.sep() + "pdfextract.exe";
- if (system.os != "WINNT") {
- binpdf = system.toolsdir() + system.sep() + "pdfextract";
- }
- //dump(binpdf + " " +JSON.stringify(args) + "\n");
- //system.popup("Import Factures!","Import du PDF '"+ pdffile.path +"' en cours!\n");
- system.runcmdline(binpdf,args,setresult);
-
-}
-
-function setresult(data){
- var strx = apppref.getpreference("pageconfig.lastpage");
- var strjresult = system.readLocalTextFile(system.profiledir()+ system.sep() + 'lastimport.json');
- var strx = apppref.getpreference("pageconfig.lastpage");
- var x = JSON.parse(strx);
-
- if (x.module == 'accounting') {
- $("#tbl_importresult > tbody").html("");
- var tblx = sortByKey(JSON.parse(strjresult));
- for (var i in tblx){
- dump(i + "\n" + JSON.stringify(tblx[i][1]) + "\n-\n");
- var xd = '<tr>';
- xd += '<td>'+tblx[i][1].reference+'</td>';
- xd += '<td>'+tblx[i][1].checkservice+'</td>';
- xd += '<td>'+tblx[i][1].sqlresult+'</td>';
- xd += '</tr>';
- $("#tbl_importresult > tbody").append(xd);
- }
- $("#importresult").html();
- $("#importprogress").hide();
- $("#btnimportfiles").show();
- $("#importresult").show();
- }
-
- }
-
-function sortByKey(jsObj){
- var sortedArray = [];
-
- // Push each JSON Object entry in array by [key, value]
- for(var i in jsObj)
- {
- sortedArray.push([i, jsObj[i]]);
- }
-
- // Run native sort function and returns sorted array.
- return sortedArray.sort();
-}
+++ /dev/null
-function initpage(){
-
-}
-// var lastpageopened = {};
-
-// function initdata(){
-// set_infoheader("");
-// }
-
-// var strlp = apppref.getpreference("pageconfig.lastpage");
-// if (strlp !== '') {
-// lastpageopened = JSON.parse(strlp);
-// }
-
-// if ((lastpageopened) && (lastpageopened.view != "") && (lastpageopened.view != "home")){
-// globelreq.send_request({page:lastpageopened.view,module:lastpageopened.module,header:lastpageopened.header},null);
-// }
+++ /dev/null
-<!DOCTYPE html>
-
-<html lang="fr">
-<head>
- <meta charset="utf-8">
-
- <title>Creorga - Creche</title>
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <meta http-equiv="cache-control" content="max-age=0" />
- <meta http-equiv="cache-control" content="no-cache" />
- <meta http-equiv="expires" content="0" />
- <meta http-equiv="expires" content="Tue, 01 Jan 1970 1:00:00 GMT" />
- <meta http-equiv="pragma" content="no-cache" />
- <link href="../../web/css/bootstrap.min.css" rel="stylesheet" type="text/css">
- <!--<link href="../../web/css/bootstrap-theme.min.css" rel="stylesheet" type="text/css">-->
- <link href="../../web/css/datatables.min.css" rel="stylesheet" type="text/css">
- <link href="../../web/css/dataTables.bootstrap.min.css" rel="stylesheet" type="text/css">
- <link href="../../web/css/bootstrap-datetimepicker.min.css" rel="stylesheet" type="text/css">
- <!-- <link href="../../web/css/bootstrap-timepicker.min.css" rel="stylesheet" type="text/css"> -->
- <link href="../../web/css/glyphicons.css" rel="stylesheet" type="text/css">
- <link href="../../web/css/creorga.css" rel="stylesheet" type="text/css">
-</head>
-
-<body>
- <div class="container-fluid" style="padding-top: 5px;">
- <!--<span class="pagehead" id="pagehead">Formulaires</span> -->
- <button onclick="dlg_addform();" id="btnadd" class="btn btn-primary" type="button">
- <span class="glyphicon glyphicon-plus"></span>
-</button>
-
-
- <!--<button onclick="return globelreq.send_request({foo: 1}, something.callback)">send {foo: 1} with callback</button>-->
- <!--<button onclick="return globelreq.send_request({baz: 3}, something.callback)">send {baz: 3} with callback</button>-->
- <table id="tbl_forms" class="table table-striped">
-
- </table>
-
- </div>
- <div class="modal fade" id="edit_forms">
- <div class="modal-dialog">
- <div class="modal-content">
- <div class="modal-header">
- <button data-dismiss="modal" class="close" type="button"><span aria-hidden="true">x</span><span class="sr-only">Close</span></button>
- <h4 class="modal-title">Ajouter/Remplacer Fichier</h4>
- </div>
- <div class="modal-body">
-
- <div id="frmeditforms">
- <input type="hidden" value="0" id="uuid" />
-
-
- <div class="form-group">
- <label for="name">Fichier</label>
- <input type="file" value="" id="file" nullable="true" class="form-control">
- </div>
- <!--<div class="form-group">
- <label for="phone">Description</label>
- <input type="text" value="" id="description" nullable="true" class="form-control">
- </div>-->
- </div>
- </div>
- <div class="modal-footer">
- <button aria-hidden="true" data-dismiss="modal" class="btn">Annuler</button> <button onclick="save_forms();" class="btn btn-primary">OK</button>
- </div>
- </div>
-
-
- </div>
- </div>
- </div>
-
- <div class="modal fade" id="confirm_delete_forms">
- <div class="modal-dialog">
- <div class="modal-content">
- <div class="modal-header">
- <button data-dismiss="modal" class="close" type="button"><span aria-hidden="true">x</span><span class="sr-only">Close</span></button>
-
- <h4 class="modal-title">Supprimer</h4>
- </div><!-- dialog contents -->
-
- <div class="modal-body">
- Êtes vous sûre de supprimer ce fichier?
-
-
- </div><!-- dialog buttons -->
-
- <div class="modal-footer">
- <button aria-hidden="true" data-dismiss="modal" class="btn">Non</button> <button onclick="delete_forms();" class="btn btn-primary">Oui</button>
- </div>
- </div>
- </div>
- </div>
- <script src="../../web/js/jquery.min.js" type="text/javascript"></script>
- <script src="../../web/js/bootstrap.min.js" type="text/javascript"></script>
- <script src="../../web/js/datatables.min.js" type="text/javascript"></script>
- <script src="chrome://creorga/content/js/preferences.js" type="text/javascript"></script>
- <script src="chrome://creorga/content/js/navigation.js" type="text/javascript"></script>
- <script src="chrome://creorga/content/js/system.js" type="text/javascript"></script>
- <script src="chrome://creorga/content/js/database.js" type="text/javascript"></script>
-
-<script src="../../web/js/creorga.js" type="text/javascript"></script>
-<script src="../../web/js/labels.js" type="text/javascript"></script>
-<script src="js/forms.js" type="text/javascript"></script>
- </body>
-</html>
-
+++ /dev/null
-<?xml version="1.0"?>
-<!DOCTYPE overlay PUBLIC "-//MOZILLA//DTD XUL V1.0//EN"
-"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
-<overlay id="ov_forms" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:html="http://www.w3.org/1999/xhtml">
- <toolbar id="co_maintoolbar" style="-moz-appearance: none;">
- <toolbarbutton class="btn btn-default" id="tbb_forms" insertbefore="tbb_space" label="Formulaires" image="modules/forms/img/doc.png" orient="vertical" oncommand="navigation.load_appview('forms','forms',null,'Formulaires');"/>
- </toolbar>
-</overlay>
\ No newline at end of file
+++ /dev/null
-//Source-code licensed under EUPL v1.1 ( Copyright 2016 By DKS s.à r.l. - Kilian Saffran - Luxembourg )
-
-var wh= window.screen.height -400;
-var myfiles = null;
-var delform = null;
-var cruuid = null;
-var candelete = 0;
-function initdata(){
- curcfg.loadconfig(apppref.getpreference("support.database.currentdb.num"));
- load_table_forms();
- set_infoheader("");
- if (system.appinfo().ID.indexOf("director")){
- candelete = 1;
- }
- }
-
-function load_table_forms(){
- var cname = appdb.dbquery("select uuid from creche LIMIT 1;");
- cruuid = cname.sqldata[0].uuid;
-
- myfiles = system.getReports(cruuid);
- var atbody = new Array();
- for (var i=0;i<myfiles.length;i++){
-
- var fname = system.getFileName(myfiles[i].path);
- if (!fname.startsWith('.')){
- var row = new Array();
- var btndelete = "";
- //if (candelete == 1){
- btndelete = '<button onclick="delete_report('+i+');" class="btn btn-danger"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span></button>';
- //}
- row.push('<button onclick="preview_report(' + i +');" class="btn btn-primary"><span class="glyphicon glyphicon-open" aria-hidden="true"></span></button>' + btndelete);
- row.push(fname);
- atbody.push(row);
- }
-
- }
-
- $("#tbl_forms").html("");
-
-
-
- var headerdata = getlabels("action,description");
- $("#tbl_forms").html("");
- $("#tbl_forms").dataTable({
- "language": {
- "url": "js/locale/datatable_fr.json"
- },
- "data": atbody,
- "columns": headerdata,
- "paging": false,
- "scrollY": wh + "px",
- "scrollCollapse": true,
- "ordering": true,
- "info": false,
- "filter": false,
- "destroy": true
- });
-}
-
-function preview_report(fi){
- var ff = system.openFile(myfiles[fi].path);
-}
-
-
-function delete_report(fi) {
- delform = fi;
- confirm_delete_forms();
-}
-
-function dlg_addform(){
- $("#edit_forms").modal('show');
-}
-
-function confirm_delete_forms(){
- $("#confirm_delete_forms").modal('show');
- return false;
-}
-
-function delete_forms(){
- OS.File.remove(myfiles[delform].path);
- setTimeout(function(){load_table_forms();$("#confirm_delete_forms").modal('hide');},3000);
- delform = null;
- return false;
-}
-
-function save_forms(){
- var file = $("#frmeditforms #file").val();
- var path = FileUtils.File(curcfg.path.local + system.sep() +"reports" + system.sep() + cruuid);
- var newlocation= path.path + system.sep() + system.getFileName(file);
- OS.File.copy(file, newlocation);
- setTimeout(function(){load_table_forms();$("#edit_forms").modal('hide');},3000);
-}
+++ /dev/null
-//Source-code licensed under EUPL v1.1 ( Copyright 2016 By DKS s.à r.l. - Kilian Saffran - Luxembourg )
-var pconfig = {};
-var winh= window.innerHeight -170;
-var tbllog = null;
-var crecheuuid = null;
-var initdate = new Date();
-var deluuid = "";
-var amonth = ['', 'Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Aôut', 'Septembre', 'Octobre','Novembre', 'Décembre'];
-var myhostname = system.hostname();
-
-function initdata(){
-
- load_helpers();
- var configdata = apppref.getpreference("pageconfig.logactivity");
- //dump("cfdata:" + configdata +"\n");
- if ((configdata) && (configdata !== '')){
- pconfig = JSON.parse(configdata);
- }
- //dump("logactivity Page new loaded!\n");
- //if (!pconfig.printlayout) {
- pconfig.printlayout = 'book';
- apppref.setpreference("pageconfig.logactivity",pconfig);
- //}
- var ccreche = appdb.dbquery("select uuid from creche LIMIT 1;");
- crecheuuid = ccreche.sqldata[0].uuid;
- var edith = 270;
- loadtextareas(edith);
- myhostname = system.hostname();
- if (pconfig.logmonth) {
-
- initdate = new Date(encodeparam(pconfig.logmonth, 'month').replace(/'/g, ''));
- $("#logmonth").val(pconfig.logmonth);
- } else {
- $("#logmonth").val(initdate.toLocaleFormat('%m.%Y'));
-
- pconfig.logmonth=initdate.toLocaleFormat("%m.%Y");
- apppref.setpreference("pageconfig.logactivity",pconfig);
- }
- var acttitle = "";
- if (pconfig.activityuuid){
- var chdata = appdb.dbquery("select logtitle from activitylog where uuid='"+ pconfig.activityuuid +"'");
- if (chdata.sqldata.length > 0){
- acttitle = chdata.sqldata[0].logtitle + " - ";
- }
- }
- //dump(JSON.stringify(pconfig) + "\n");
- set_infoheader(acttitle + " Mois: " + amonth[parseInt(pconfig.logmonth.substring(0, 3))] + " " + pconfig.logmonth.substring(3, 8));
-
- $('#logmonth').on('dp.hide', function(e) {
- set_logmonth();
- });
- $("#btnedit").hide();
- $("#btnprotection").hide();
- $("#btndelete").hide();
- load_logactivity_table();
-
-}
-
-
-
-function load_logactivity_table(){
- var mins = initdate.getTimezoneOffset() * -1;//dump("cur timezoneoffset:" + + "\n");
- if (mins > 0){
- mins = '+' + mins;
- }
- var logsql = "SELECT uuid, logtitle, strftime('%d.%m.%Y',logdatefrom) as logdatefrom, strftime('%d.%m.%Y',logdateto) as logdateto,'<span style=\"display:none\">' || lastmodified || '</span>' || strftime('%d.%m.%Y %H:%M',lastmodified,'"+mins+" minutes') as lastmodified,editor FROM activitylog where date(logdatefrom) between date('"+initdate.toLocaleFormat("%Y-%m")+"-01') and date('"+initdate.toLocaleFormat("%Y-%m")+"-01','+1 month','-1 day') or logdateto between date('"+initdate.toLocaleFormat("%Y-%m")+"-01') and date('"+initdate.toLocaleFormat("%Y-%m")+"-01','+1 month','-1 day');";
- var logdata = appdb.dbquery(logsql);
- var headerdata = getlabels("activity,lastmodified,editor");
- $("#tbl_logactivity").html("");
-
- var tblheader = '<tr>';
-
- for (var h in headerdata){
- if ((headerdata[h].keyname == 'act') && (headerdata[h].class.indexOf('action1btn') == -1)){
- headerdata[h].class +=" action1btn";
- }
-
- tblheader += '<th class="' + headerdata[h].class +'">'+ headerdata[h].title+'</th>';
-
- }
- tblheader += '</tr>';
-
-
- $("#tbl_logactivity").append("<thead>" + tblheader + "</thead>");
- $("#tbl_logactivity").append("<tfoot>" + tblheader + "</tfoot>");
- $("#tbl_logactivity").append("<tbody>");
-
-
- for (var i in logdata.sqldata){
- var sel = "";
- var row = logdata.sqldata[i];
- if (pconfig.activityuuid && row.uuid == pconfig.activityuuid) {
- sel = "selected";
- load_activitylog();
- }
- //<td><button type="button" class="btn btn-danger" onclick="confirm_delete_logactivity(\''+ row.uuid +'\');" title=\"supprimer\"><span class=\"glyphicon glyphicon-remove\"></span></button></td>
- //!= '')?'<button class="btn btn-danger" id="btnprotection" onclick="confirm_delete_protection();" style="display: none;"><span class="glyphicon glyphicon-remove"></span></button>':'') +row.editor
- var tr = '<tr data-activity="'+ row.uuid+'" data-editor="'+row.editor+'" class="'+ sel+'"><td>' + row.logtitle + '<br/><i>' + row.logdatefrom +' - ' + row.logdateto + '</i></td>'+
- '<td>'+ row.lastmodified+'</td>'+'<td>'+ row.editor +'</td>'+
- '</tr>';
-
- $("#tbl_logactivity").append(tr);
- }
-
- $("#tbl_logactivity").append("</tbody>");
-
-
- tbllog = $("#tbl_logactivity").dataTable({
- "language": {
- "url": "../../web/js/locale/datatable_fr.json"
- },
- "paging": false,
- "ordering": true,
- "bAutoWidth": false,
- "scrollY": winh + "px",
- "scrollCollapse": true,
- "info": false,
- "filter": false,
- "destroy": true,
- });
-
-
-
- $('#tbl_logactivity').on( 'order.dt', function () {
- pconfig.order= tbllog.fnSettings().aaSorting;
- apppref.setpreference("pageconfig.logactivity",pconfig);
-
- } );
-
- if (pconfig.order) {
-
- tbllog.fnSort(pconfig.order);
- }
-
- $('#tbl_logactivity tbody').on( 'click', 'tr', function () {
- //dump("select activity\n");
- if ( $(this).hasClass('selected') ) {
- // $(this).removeClass('selected');
- }
- else {
- //dump("select activity\n");
- $("#btnedit").hide();
- $("#btnprotection").hide();
- $("#btndelete").hide();
- tbllog.$('tr.selected').removeClass('selected');
- $(this).addClass('selected');
- var curactivity = $(this).attr('data-activity');
- pconfig.activityuuid = curactivity;
- var actlogsql = "SELECT editor FROM activitylog where uuid='"+ pconfig.activityuuid+"';";
- var adata = appdb.dbquery(actlogsql);
-
- if (adata.sqldata[0].editor == '' || adata.sqldata[0].editor == myhostname){
- $("#btnedit").show();
- $("#btndelete").show();
- }
- if (adata.sqldata[0].editor != '' && adata.sqldata[0].editor != myhostname){
- $("#btnprotection").show();
- }
- //setforeigneditor($(this).attr('data-editor'));
- apppref.setpreference("pageconfig.logactivity",pconfig);
- load_activitylog();
- }
- } );
-
-}
-
-
-
-function newlogactivity(){
- var nuuid = appdb.generate_uuid();
- var sql = "INSERT INTO activitylog (uuid,logtitle,logdatefrom,logdateto) VALUES ('"+nuuid+"','nouvelle Activité',date('"+initdate.toLocaleFormat('%Y-%m-%d')+"'),date('"+initdate.toLocaleFormat('%Y-%m-%d')+"'));";
- appdb.dbexec(sql);
- pconfig.activityuuid=nuuid;
- apppref.setpreference("pageconfig.logactivity",pconfig);
- edit_activitylog();
- //load_logactivity_table();
-}
-
-function load_activitylog(){
- $("#btnedit").hide();
- $("#btnprotection").hide();
- $("#btndelete").hide();
- var actlogsql = "SELECT uuid, strftime('%d.%m.%Y',logdatefrom) as logdatefrom, strftime('%d.%m.%Y',logdateto) as logdateto, logtitle, logmessage,editor FROM activitylog where uuid='"+ pconfig.activityuuid+"';";
- var adata = appdb.dbquery(actlogsql);
- var inftitle = "";
- if (adata.sqldata.length > 0){
- $("#activityloguuid").val(adata.sqldata[0].uuid);
- $("#activitylogmessage").html(htmlUnescape(adata.sqldata[0].logmessage))
- $("#activitylogtitle").html(adata.sqldata[0].logtitle);
- $("#activitylogdatefrom").html(adata.sqldata[0].logdatefrom);
- $("#activitylogdateto").html(adata.sqldata[0].logdateto);
- if (adata.sqldata[0].editor == '' || adata.sqldata[0].editor == myhostname){
- $("#btnedit").show();
- $("#btndelete").show();
- }
- if (adata.sqldata[0].editor != '' && adata.sqldata[0].editor != myhostname){
- $("#btnprotection").show();
- }
-
- inftitle=adata.sqldata[0].logtitle;
- }else {
- $("#activityloguuid").val(0);
- $("#activitylogmessage").html("");
- $("#activitylogtitle").html('');
- $("#activitylogdatefrom").html('');
- $("#activitylogdateto").html('');
- }
-
- set_infoheader(inftitle + " Mois: " + amonth[parseInt(pconfig.logmonth.substring(0, 3))] + " " + pconfig.logmonth.substring(3, 8));
-
-}
-
-function edit_activitylog(){
- var actlogsql = "SELECT uuid, strftime('%d.%m.%Y',logdatefrom) as logdatefrom, strftime('%d.%m.%Y',logdateto) as logdateto, logtitle, logmessage,editor FROM activitylog where uuid='"+ pconfig.activityuuid+"';";
-
- var adata = appdb.dbquery(actlogsql);
- //dump("EDIT: " + JSON.stringify(chdata) + "\n");
- if ((adata.sqldata[0].editor != '') && (adata.sqldata[0].editor != myhostname)){
- system.popup("cette activité est bloqué par l'editeur: " + adata.sqldata[0].editor);
- load_logactivity_table();
- return;
- }
- seteditorhost();
- if (adata.sqldata.length > 0){
- $('#frmeditactivitylog #loguuid').val(adata.sqldata[0].uuid);
- $("#frmeditactivitylog #logtitle").val(adata.sqldata[0].logtitle);
- $("#frmeditactivitylog #logdatefrom").val(adata.sqldata[0].logdatefrom);
- $("#frmeditactivitylog #logdateto").val(adata.sqldata[0].logdateto);
- $("#frmeditactivitylog #logmessage").summernote('reset');
- $("#frmeditactivitylog #logmessage").summernote('code',htmlUnescape(adata.sqldata[0].logmessage));
- }
- $("#edit_activitylog").modal('show');
-}
-
-function save_activitylog(){
- var lsql = "";
- //dump($('#frmeditactivitylog #logdateto').val() + " - " + $('#frmeditactivitylog #logdatefrom').val() + "\n");
- $("#activityloguuid").val($("#frmeditactivitylog #loguuid").val());
- //var tmpdate = encodeparam(pconfig.logdate, 'date').replace(/'/g, '');
- var dt = encodeparam($("#frmeditactivitylog #logdateto").val(),"date");
- var df = encodeparam($("#frmeditactivitylog #logdatefrom").val(),"date");
- var ltitle = encodeparam($('#frmeditactivitylog #logtitle').val(),"text");
- var lmessage = encodeparam($('#frmeditactivitylog #logmessage').val(),"richtextarea");
- var uid = $("#frmeditactivitylog #loguuid").val();
- //dump(df + " - " + dt + "\n");
- var lsql = "UPDATE activitylog set logtitle="+ltitle+
- ",logmessage="+lmessage+
- ",logdatefrom=date("+df+")"+
- ",logdateto=date("+dt+") where uuid='"+uid+"';";
- //dump(lsql + "\n");
- appdb.dbexec(lsql);
- removeeditorhost();
- load_logactivity_table();
- //load_activitylog();
- $("#edit_activitylog").modal('hide');
-}
-
-function confirm_delete_activity() {
-
- deluuid = $("#activityloguuid").val();
- $('#confirm_delete_logactivity').modal('show');
-}
-
-function delete_logactivity() {
- appdb.dbexec("delete from activitylog where uuid='"+ deluuid+"';");
- load_logactivity_table();
- $('#confirm_delete_logactivity').modal('hide');
-}
-
-function onnextmonth() {
- var tmpmonth = new Date(encodeparam(pconfig.logmonth, 'month').replace(/'/g, ''));
- var nmonth = new Date(tmpmonth.getFullYear(), tmpmonth.getMonth() + 1, tmpmonth.getDate());
- pconfig.logmonth = nmonth.toLocaleFormat('%m.%Y');
- apppref.setpreference("pageconfig.logactivity", pconfig);
- globelreq.send_request({
- page: 'logactivity',
- module: 'logbook',
- header: 'Livret des activités'
- }, null);
-}
-
-function onpreviousmonth() {
- var tmpmonth = new Date(encodeparam(pconfig.logmonth, 'month').replace(/'/g, ''));
- var nmonth = new Date(tmpmonth.getFullYear(), tmpmonth.getMonth() - 1, tmpmonth.getDate());
- pconfig.logmonth = nmonth.toLocaleFormat('%m.%Y');
- apppref.setpreference("pageconfig.logactivity", pconfig);
- globelreq.send_request({
- page: 'logactivity',
- module: 'logbook',
- header: 'Livret des activités'
- }, null);
-}
-
-function set_logmonth(){
- pconfig.logmonth =$("#logmonth").val();
- apppref.setpreference("pageconfig.logactivity",pconfig);
- globelreq.send_request({
- page: 'logactivity',
- module: 'logbook',
- header: 'Livret des activités'
- });
-}
-
-function seteditorhost(){
- appdb.dbexec("UPDATE activitylog set editor=null where editor='"+myhostname+"';");
- appdb.dbexec("UPDATE activitylog set editor='"+myhostname+"' where uuid='"+$('#activityloguuid').val()+"';");
-}
-
-function removeeditorhost(){
- appdb.dbexec("UPDATE activitylog set editor=null where editor='"+myhostname+"';");
-}
-
-
-function confirm_delete_protection(){
- $("#confirm_delete_protection").modal('show');
-}
-
-function delete_protection(){
- appdb.dbexec("UPDATE activitylog set editor=null where uuid='"+$('#activityloguuid').val()+"';");
- $('#editorhost').html('');
- $('#btneditorhost').removeClass('btn-danger');
- $('#btneditorhost').addClass('btn-default');
- $('#btnprotection').hide();
- load_logactivity_table();
- $("#confirm_delete_protection").modal('hide');
-}
\ No newline at end of file
+++ /dev/null
-//Source-code licensed under EUPL v1.1 ( Copyright 2016 By DKS s.à r.l. - Kilian Saffran - Luxembourg )
-var pconfig = {};
-var winh= window.innerHeight -170;
-var tbllog = null;
-var crecheuuid = null;
-var initdate = new Date();
-var deluuid = "";
-var amonth = ['', 'Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Aôut', 'Septembre', 'Octobre','Novembre', 'Décembre'];
-var myhostname = system.hostname();
-
-function initdata(){
-
- load_helpers();
- var configdata = apppref.getpreference("pageconfig.logactivity");
- //dump("cfdata:" + configdata +"\n");
- if ((configdata) && (configdata !== '')){
- pconfig = JSON.parse(configdata);
- }
- //dump("logactivity Page new loaded!\n");
- //if (!pconfig.printlayout) {
- pconfig.printlayout = 'book';
- apppref.setpreference("pageconfig.logactivity",pconfig);
- //}
- var ccreche = appdb.dbquery("select uuid from creche LIMIT 1;");
- crecheuuid = ccreche.sqldata[0].uuid;
- var edith = 270;
- loadtextareas(edith);
- myhostname = system.hostname();
- if (pconfig.logmonth) {
-
- initdate = new Date(encodeparam(pconfig.logmonth, 'month').replace(/'/g, ''));
- $("#logmonth").val(pconfig.logmonth);
- } else {
- $("#logmonth").val(initdate.toLocaleFormat('%m.%Y'));
-
- pconfig.logmonth=initdate.toLocaleFormat("%m.%Y");
- apppref.setpreference("pageconfig.logactivity",pconfig);
- }
- var acttitle = "";
- if (pconfig.activityuuid){
- var chdata = appdb.dbquery("select logtitle from activitylog where uuid='"+ pconfig.activityuuid +"'");
- if (chdata.sqldata.length > 0){
- acttitle = chdata.sqldata[0].logtitle + " - ";
- }
- }
- //dump(JSON.stringify(pconfig) + "\n");
- set_infoheader(acttitle + " Mois: " + amonth[parseInt(pconfig.logmonth.substring(0, 3))] + " " + pconfig.logmonth.substring(3, 8));
-
- $('#logmonth').on('dp.hide', function(e) {
- set_logmonth();
- });
- $("#btnedit").hide();
-
- load_logactivity_table();
-
-}
-
-
-
-function load_logactivity_table(){
- var mins = initdate.getTimezoneOffset() * -1;//dump("cur timezoneoffset:" + + "\n");
- if (mins > 0){
- mins = '+' + mins;
- }
- var logsql = "SELECT uuid, logtitle, strftime('%d.%m.%Y',logdatefrom) as logdatefrom, strftime('%d.%m.%Y',logdateto) as logdateto,'<span style=\"display:none\">' || lastmodified || '</span>' || strftime('%d.%m.%Y %H:%M',lastmodified,'"+mins+" minutes') as lastmodified,editor FROM activitylog where date(logdatefrom) between date('"+initdate.toLocaleFormat("%Y-%m")+"-01') and date('"+initdate.toLocaleFormat("%Y-%m")+"-01','+1 month','-1 day') or logdateto between date('"+initdate.toLocaleFormat("%Y-%m")+"-01') and date('"+initdate.toLocaleFormat("%Y-%m")+"-01','+1 month','-1 day');";
- var logdata = appdb.dbquery(logsql);
- var headerdata = getlabels("activity,lastmodified,editor");
- $("#tbl_logactivity").html("");
-
- var tblheader = '<tr>';
-
- for (var h in headerdata){
- if ((headerdata[h].keyname == 'act') && (headerdata[h].class.indexOf('action1btn') == -1)){
- headerdata[h].class +=" action1btn";
- }
-
- tblheader += '<th class="' + headerdata[h].class +'">'+ headerdata[h].title+'</th>';
-
- }
- tblheader += '</tr>';
-
-
- $("#tbl_logactivity").append("<thead>" + tblheader + "</thead>");
- $("#tbl_logactivity").append("<tfoot>" + tblheader + "</tfoot>");
- $("#tbl_logactivity").append("<tbody>");
-
-
- for (var i in logdata.sqldata){
- var sel = "";
- var row = logdata.sqldata[i];
- if (pconfig.activityuuid && row.uuid == pconfig.activityuuid) {
- sel = "selected";
- load_activitylog();
- }
-
- var tr = '<tr data-activity="'+ row.uuid+'" data-editor="'+row.editor+'" class="'+ sel+'"><td>' + row.logtitle + '<br/><i>' + row.logdatefrom +' - ' + row.logdateto + '</i></td>'+
- '<td>'+ row.lastmodified+'</td>'+'<td>'+ row.editor +'</td>'+
- '</tr>';
-
- $("#tbl_logactivity").append(tr);
- }
-
- $("#tbl_logactivity").append("</tbody>");
-
-
- tbllog = $("#tbl_logactivity").dataTable({
- "language": {
- "url": "../../web/js/locale/datatable_fr.json"
- },
- "paging": false,
- "ordering": true,
- "bAutoWidth": false,
- "scrollY": winh + "px",
- "scrollCollapse": true,
- "info": false,
- "filter": false,
- "destroy": true,
- });
-
-
-
- $('#tbl_logactivity').on( 'order.dt', function () {
- pconfig.order= tbllog.fnSettings().aaSorting;
- apppref.setpreference("pageconfig.logactivity",pconfig);
-
- } );
-
- if (pconfig.order) {
-
- tbllog.fnSort(pconfig.order);
- }
-
- $('#tbl_logactivity tbody').on( 'click', 'tr', function () {
- //dump("select activity\n");
- if ( $(this).hasClass('selected') ) {
- // $(this).removeClass('selected');
- }
- else {
- //dump("select activity\n");
- $("#btnedit").hide();
- tbllog.$('tr.selected').removeClass('selected');
- $(this).addClass('selected');
- var curactivity = $(this).attr('data-activity');
- var actlogsql = "SELECT editor FROM activitylog where uuid='"+ pconfig.activityuuid+"';";
- var adata = appdb.dbquery(actlogsql);
- pconfig.activityuuid = curactivity;
- if (adata.sqldata[0].editor == '' || adata.sqldata[0].editor == myhostname){
- $("#btnedit").show();
- }
- //setforeigneditor($(this).attr('data-editor'));
- apppref.setpreference("pageconfig.logactivity",pconfig);
- load_activitylog();
- }
- } );
-
-}
-
-
-
-function newlogactivity(){
- var nuuid = appdb.generate_uuid();
- var sql = "INSERT INTO activitylog (uuid,logtitle,logdatefrom,logdateto) VALUES ('"+nuuid+"','nouvelle Activité',date('"+initdate.toLocaleFormat('%Y-%m-%d')+"'),date('"+initdate.toLocaleFormat('%Y-%m-%d')+"'));";
- appdb.dbexec(sql);
- pconfig.activityuuid=nuuid;
- apppref.setpreference("pageconfig.logactivity",pconfig);
- edit_activitylog();
- //load_logactivity_table();
-}
-
-function load_activitylog(){
- $("#btnedit").hide();
- var actlogsql = "SELECT uuid, strftime('%d.%m.%Y',logdatefrom) as logdatefrom, strftime('%d.%m.%Y',logdateto) as logdateto, logtitle, logmessage,editor FROM activitylog where uuid='"+ pconfig.activityuuid+"';";
- var adata = appdb.dbquery(actlogsql);
- var inftitle = "";
- if (adata.sqldata.length > 0){
- $("#activityloguuid").val(adata.sqldata[0].uuid);
- $("#activitylogmessage").html(htmlUnescape(adata.sqldata[0].logmessage))
- $("#activitylogtitle").html(adata.sqldata[0].logtitle);
- $("#activitylogdatefrom").html(adata.sqldata[0].logdatefrom);
- $("#activitylogdateto").html(adata.sqldata[0].logdateto);
- if (adata.sqldata[0].editor == '' || adata.sqldata[0].editor == myhostname){
- $("#btnedit").show();
- }
-
- inftitle=adata.sqldata[0].logtitle;
- }else {
- $("#activityloguuid").val(0);
- $("#activitylogmessage").html("");
- $("#activitylogtitle").html('');
- $("#activitylogdatefrom").html('');
- $("#activitylogdateto").html('');
- }
-
- set_infoheader(inftitle + " Mois: " + amonth[parseInt(pconfig.logmonth.substring(0, 3))] + " " + pconfig.logmonth.substring(3, 8));
-
-}
-
-function edit_activitylog(){
- var actlogsql = "SELECT uuid, strftime('%d.%m.%Y',logdatefrom) as logdatefrom, strftime('%d.%m.%Y',logdateto) as logdateto, logtitle, logmessage,editor FROM activitylog where uuid='"+ pconfig.activityuuid+"';";
- var adata = appdb.dbquery(actlogsql);
- if ((adata.sqldata[0].editor != '') && (adata.sqldata[0].editor != myhostname)){
- system.popup("cette activité est bloqué par l'editeur: " + adata.sqldata[0].editor);
- return;
- }
- //dump("EDIT: " + JSON.stringify(chdata) + "\n");
- seteditorhost();
- if (adata.sqldata.length > 0){
- $('#frmeditactivitylog #loguuid').val(adata.sqldata[0].uuid);
- $("#frmeditactivitylog #logtitle").val(adata.sqldata[0].logtitle);
- $("#frmeditactivitylog #logdatefrom").val(adata.sqldata[0].logdatefrom);
- $("#frmeditactivitylog #logdateto").val(adata.sqldata[0].logdateto);
- $("#frmeditactivitylog #logmessage").summernote('reset');
- $("#frmeditactivitylog #logmessage").summernote('code',htmlUnescape(adata.sqldata[0].logmessage));
- }
- $("#edit_activitylog").modal('show');
-}
-
-function save_activitylog(){
- var lsql = "";
- //dump($('#frmeditactivitylog #logdateto').val() + " - " + $('#frmeditactivitylog #logdatefrom').val() + "\n");
- $("#activityloguuid").val($("#frmeditactivitylog #loguuid").val());
- //var tmpdate = encodeparam(pconfig.logdate, 'date').replace(/'/g, '');
- var dt = encodeparam($("#frmeditactivitylog #logdateto").val(),"date");
- var df = encodeparam($("#frmeditactivitylog #logdatefrom").val(),"date");
- var ltitle = encodeparam($('#frmeditactivitylog #logtitle').val(),"text");
- var lmessage = encodeparam($('#frmeditactivitylog #logmessage').val(),"richtextarea");
- var uid = $("#frmeditactivitylog #loguuid").val();
- //dump(df + " - " + dt + "\n");
- var lsql = "UPDATE activitylog set logtitle="+ltitle+
- ",logmessage="+lmessage+
- ",logdatefrom=date("+df+")"+
- ",logdateto=date("+dt+") where uuid='"+uid+"';";
- //dump(lsql + "\n");
- appdb.dbexec(lsql);
- removeeditorhost();
- load_logactivity_table();
- //load_activitylog();
- $("#edit_activitylog").modal('hide');
-}
-
-function onnextmonth() {
- var tmpmonth = new Date(encodeparam(pconfig.logmonth, 'month').replace(/'/g, ''));
- var nmonth = new Date(tmpmonth.getFullYear(), tmpmonth.getMonth() + 1, tmpmonth.getDate());
- pconfig.logmonth = nmonth.toLocaleFormat('%m.%Y');
- apppref.setpreference("pageconfig.logactivity", pconfig);
- globelreq.send_request({
- page: 'logactivity_basic',
- module: 'logbook',
- header: 'Livret des activités'
- }, null);
-}
-
-function onpreviousmonth() {
- var tmpmonth = new Date(encodeparam(pconfig.logmonth, 'month').replace(/'/g, ''));
- var nmonth = new Date(tmpmonth.getFullYear(), tmpmonth.getMonth() - 1, tmpmonth.getDate());
- pconfig.logmonth = nmonth.toLocaleFormat('%m.%Y');
- apppref.setpreference("pageconfig.logactivity", pconfig);
- globelreq.send_request({
- page: 'logactivity_basic',
- module: 'logbook',
- header: 'Livret des activités'
- }, null);
-}
-
-function set_logmonth(){
- pconfig.logmonth =$("#logmonth").val();
- apppref.setpreference("pageconfig.logactivity",pconfig);
- globelreq.send_request({
- page: 'logactivity_basic',
- module: 'logbook',
- header: 'Livret des activités'
- });
-}
-
-function seteditorhost(){
- appdb.dbexec("UPDATE activitylog set editor=null where editor='"+myhostname+"';");
- appdb.dbexec("UPDATE activitylog set editor='"+myhostname+"' where uuid='"+$('#loguuid').val()+"';");
-}
-
-function removeeditorhost(){
- appdb.dbexec("UPDATE activitylog set editor=null where editor='"+myhostname+"';");
-}
+++ /dev/null
-//Source-code licensed under EUPL v1.1 ( Copyright 2016 By DKS s.à r.l. - Kilian Saffran - Luxembourg )
-var pconfig = {};
-var winh= window.innerHeight -170;
-var tbllog = null;
-var crecheuuid = null;
-var initdate = new Date();
-var myhostname = system.hostname();
-
-function initdata(){
-
- load_helpers();
- var configdata = apppref.getpreference("pageconfig.logchild");
-
- if ((configdata) && (configdata !== '')){
- pconfig = JSON.parse(configdata);
- }
- //dump(JSON.stringify(pconfig) + "\n");
- //if (!pconfig.printlayout) {
- pconfig.printlayout = 'logchild';
- apppref.setpreference("pageconfig.logchild",pconfig);
- //}
- var ccreche = appdb.dbquery("select uuid from creche LIMIT 1;");
- crecheuuid = ccreche.sqldata[0].uuid;
-
- loadtextareas(winh);
- $("#logdate").on("dp.hide", function () {
- set_logdate();
- });
- myhostname = system.hostname();
- if (pconfig.logdate) {
-
- initdate = new Date(encodeparam(pconfig.logdate, 'date').replace(/'/g, ''));
- $("#logdate").val(pconfig.logdate);
- } else {
- $("#logdate").val(initdate.toLocaleFormat('%d.%m.%Y'));
- pconfig.logdate = initdate.toLocaleFormat('%d.%m.%Y');
- }
- var childname = "";
- if (pconfig.childuuid){
- var chdata = appdb.dbquery("select prename || ' ' || surname AS childname from childs where uuid='"+ pconfig.childuuid +"'");
- if (chdata.sqldata.length > 0){
- childname = chdata.sqldata[0].childname + " - ";
- }
- }
- set_infoheader(childname + " Date du: " + pconfig.logdate);
- load_logchild_table();
-
-}
-
-
-
-
-
-function load_logchild_table(){
- var mins = initdate.getTimezoneOffset() * -1;//dump("cur timezoneoffset:" + + "\n");
- if (mins > 0){
- mins = '+' + mins;
- }
- var sqlchilds = "select distinct(ch.uuid) as uuid, ch.prename || ' ' || ch.surname AS childname, ch.checkservicenumber,gr.grpname,'<span style=\"display:none\">' || cl.lastmodified || '</span>' || strftime('%d.%m.%Y %H:%M',cl.lastmodified,'"+mins+" minutes') as lastmodified,cl.editor as editor from childs ch left join planning pl on (ch.uuid=pl.childuuid) left join groups gr on (pl.groupuuid=gr.uuid) left join childslog cl on (ch.uuid=cl.childuuid and logdate=date('"+initdate.toLocaleFormat('%Y-%m-%d')+"')) where date('"+ initdate.toLocaleFormat('%Y-%m-%d')+"') between pl.datebegin and pl.dateend order by childname;";
- //dump("SQLChilds:" + sqlchilds + "\n");
- var logdata = appdb.dbquery(sqlchilds);
- //dump("load childs Log!\n");
- var headerdata = getlabels("childname,grpname,lastmodified,editor");
-
- $("#tbl_logchild").html("");
- //if (tbllog) {tbllog.destroy();}
- var tblheader = '<tr>';
-
- for (var h in headerdata){
- if ((headerdata[h].keyname == 'act') && (headerdata[h].class.indexOf('action1btn') == -1)){
- headerdata[h].class +=" action1btn";
- }
- if ((pconfig.hidden_columns) && (pconfig.hidden_columns.indexOf(headerdata[h].keyname) != -1)) {
- if (headerdata[h].class.indexOf('colhidden') == -1) {
- headerdata[h].class += " colhidden";
- }
- }else {
- headerdata[h].class.replace("colhidden","");
- }
- tblheader += '<th class="' + headerdata[h].class +'">'+ headerdata[h].title+'</th>';
-
- }
- tblheader += '</tr>';
-
-
- $("#tbl_logchild").append("<thead>" + tblheader + "</thead>");
- $("#tbl_logchild").append("<tfoot>" + tblheader + "</tfoot>");
- $("#tbl_logchild").append("<tbody>");
-
- //var curchld = "";
-
- for (var i in logdata.sqldata){
- var row = logdata.sqldata[i];
- var sel = "";
- if (pconfig.childuuid && row.uuid == pconfig.childuuid) {
- sel = "selected";
- load_childlog();
- }
- var tr = '<tr data-child="'+ row.uuid+'" class="'+ sel +'">';
- //tr += '<td class="noprint"></td>';
- tr += '<td>' + row.childname +'<br/>('+ row.checkservicenumber+ ')'+ "</td>";
- tr += '<td>' + row.grpname + "</td>";
- tr += '<td>' + row.lastmodified + "</td>";
- tr += '<td>' + row.editor + "</td>";
- tr += "</tr>";
- $("#tbl_logchild").append(tr);
- }
-
- $("#tbl_logchild").append("</tbody>");
-
-
- tbllog = $("#tbl_logchild").dataTable({
- "language": {
- "url": "../../web/js/locale/datatable_fr.json"
- },
- "paging": false,
- "ordering": true,
- "bAutoWidth": false,
- "scrollY": winh + "px",
- "scrollCollapse": true,
- "info": false,
- "filter": false,
- "destroy": true,
- });
-
-// $('#tbl_logchild').on( 'search.dt', function () {
-// pconfig.filter = tbllog.api().search();
-// apppref.setpreference("pageconfig.logchild",pconfig);
-// } );
-
- $('#tbl_logchild').on( 'order.dt', function () {
- pconfig.order= tbllog.fnSettings().aaSorting;
- apppref.setpreference("pageconfig.logchild",pconfig);
-
- } );
-// if (pconfig.filter) {
-// tbllog.fnFilter(pconfig.filter);
-// }
- if (pconfig.order) {
-
- tbllog.fnSort(pconfig.order);
- }
-
-
-
-
-$('#tbl_logchild tbody').on( 'click', 'tr', function () {
- if ( $(this).hasClass('selected') ) {
- // $(this).removeClass('selected');
- }
- else {
- tbllog.$('tr.selected').removeClass('selected');
- $(this).addClass('selected');
- var curchild = $(this).attr('data-child');
- pconfig.childuuid = curchild;
- var chsel = appdb.dbquery("select lastmodified,editor from childslog where childuuid='"+pconfig.childuuid+"' and logdate=date('"+initdate.toLocaleFormat('%Y-%m-%d')+"');");
- //dump(JSON.stringify(chsel) + "\n");
- $("#btnadd").hide();
- $("#btnedit").hide();
- $("#btnprotection").hide();
- if (chsel.sqldata.length > 0){
- if (chsel.sqldata[0].editor == '' || chsel.sqldata[0].editor == myhostname){
- $("#btnedit").show();
- }
- if (chsel.sqldata[0].editor != '' && chsel.sqldata[0].editor != myhostname){
- $("#btnprotection").show();
- }
-
-
- load_childlog();
- } else {
- $("#childlogmessage").html("");
- $("#btnadd").show();
- }
- apppref.setpreference("pageconfig.logchild",pconfig);
-
- }
- } );
-}
-
-function load_childlog(){
- //$("#childlogmessage").summernote('disable');
- var tmpdate = encodeparam(pconfig.logdate, 'date').replace(/'/g, '');
- var childlogsql = "select uuid,logmessage,childuuid,lastmodified,editor from childslog where logdate=date('" + tmpdate + "') and childuuid='"+ pconfig.childuuid+"';";
- var chdata = appdb.dbquery(childlogsql);
- $("#btnadd").hide();
- $("#btnedit").hide();
- $("#btnprotection").hide();
- //dump(childlogsql + " -> " +JSON.stringify(chdata) + "\n");
- $("#childlogmessage").html("");
- if (chdata.sqldata.length > 0){
- if (chdata.sqldata[0].editor == '' || chdata.sqldata[0].editor == myhostname){
- $("#btnedit").show();
- }
- if (chdata.sqldata[0].editor != '' && chdata.sqldata[0].editor != myhostname){
- $("#btnprotection").show();
- }
- //dump("load data from db\n");
- $("#childloguuid").val(chdata.sqldata[0].uuid);
- $("#childlogmessage").html(htmlUnescape(chdata.sqldata[0].logmessage));
- }else {
- //$("#childlogmessage").html("");
- $("#btnadd").show();
- }
- var childname = "";
- if (pconfig.childuuid){
- var chxdata = appdb.dbquery("select prename || ' ' || surname AS childname from childs where uuid='"+ pconfig.childuuid +"'");
- if (chxdata.sqldata.length > 0){
- childname = chxdata.sqldata[0].childname + " - ";
- }
- }
- set_infoheader(childname + " Date du: " + pconfig.logdate);
-}
-
-
-function edit_childlog(){
- var childlogsql = "select uuid,logmessage,childuuid,editor from childslog where uuid='"+$("#childloguuid").val()+"';";
- var chdata = appdb.dbquery(childlogsql);
- if ((chdata.sqldata[0].editor != '') && (chdata.sqldata[0].editor != myhostname)){
- system.popup("cette fiche d'évaluation est bloqué par l'editeur: " + chdata.sqldata[0].editor);
- load_logchild_table()();
- return;
- }
- //dump("EDIT: " + JSON.stringify(chdata) + "\n");
- seteditorhost();
- if (chdata.sqldata.length > 0){
- //$('#frmeditchildlog #logmessage').summernote('reset');
- $('#frmeditchildlog #uuid').val(chdata.sqldata[0].uuid);
- $('#frmeditchildlog #childuuid').val(chdata.sqldata[0].childuuid);
- $("#frmeditchildlog #logmessage").summernote('reset');
- $("#frmeditchildlog #logmessage").summernote('code',htmlUnescape(chdata.sqldata[0].logmessage));
- //$('#frmeditchildlog #logmessage').val(htmlUnescape(chdata.sqldata[0].logmessage));
- }
- $("#edit_childlog").modal('show');
-}
-
-function save_childlog(){
- var lsql = "";
- if ($('#frmeditchildlog #uuid').val() == '0'){
- //new childlog
- var nuuid = appdb.generate_uuid();
- $("#childloguuid").val(nuuid);
- var tmpdate = encodeparam(pconfig.logdate, 'date').replace(/'/g, '');
- lsql = "INSERT INTO childslog (uuid,childuuid,logmessage,logdate) VALUES ('"+nuuid+"','"+pconfig.childuuid+"'," + encodeparam($('#frmeditchildlog #logmessage').val(),"richtextarea")+",date('"+tmpdate+"'));";
- }else {
- //update childlog;
- lsql = "UPDATE childslog set logmessage="+encodeparam($('#frmeditchildlog #logmessage').val(),"richtextarea")+" where uuid='"+$("#frmeditchildlog #uuid").val()+"';";
- }
- appdb.dbexec(lsql);
- removeeditorhost();
- load_logchild_table();
- load_childlog();
- $("#edit_childlog").modal('hide');
-}
-//$('#childlogmessage').on('summernote.focus', function() {
-// seteditorhost();
-// $("#childlogmessage").summernote('enable');
-// });
-//
-//
-//$('#childlogmessage').on('summernote.blur', function() {
-// //dump("New Data\n");
-// var lsql = "";
-// if ($("#childloguuid").val() != "0"){
-// //UPDATE
-// lsql = "UPDATE childslog set logmessage="+encodeparam($('#childlogmessage').val(),"richtextarea")+" where uuid='"+$("#childloguuid").val()+"';";
-// //dump("UPDATE:" + lsql + "\n");
-// } else {
-// //INSERT
-// var nuuid = appdb.generate_uuid();
-// $("#childloguuid").val(nuuid);
-// var tmpdate = encodeparam(pconfig.logdate, 'date').replace(/'/g, '');
-// lsql = "INSERT INTO childslog (uuid,childuuid,logmessage,logdate) VALUES ('"+nuuid+"','"+pconfig.childuuid+"'," + encodeparam($('#childlogmessage').val(),"richtextarea")+",date('"+tmpdate+"'));";
-// //dump("INSERT:" + lsql + "\n");
-// }
-// appdb.dbexec(lsql);
-// removeeditorhost();
-// //load_logchild_table();
-//
-//});
-
-function addchildlog(){
- var nuuid = appdb.generate_uuid();
- var tmpdate = encodeparam(pconfig.logdate, 'date').replace(/'/g, '');
- $("#childloguuid").val(nuuid);
- var lsql = "INSERT INTO childslog (uuid,childuuid,logmessage,logdate) VALUES ('"+nuuid+"','"+pconfig.childuuid+"',null,date('"+tmpdate+"'));";
- appdb.dbexec(lsql);
- edit_childlog();
-
-}
-
-
-function set_logdate(){
- pconfig.logdate =$("#logdate").val();
- //dump("set_logdate:" + JSON.stringify(pconfig) + "\n");
- apppref.setpreference("pageconfig.logchild",pconfig);
- removeeditorhost();
- globelreq.send_request({
- page: 'logchild',
- module: 'logbook',
- data: null,
- header: 'Livret d\'évaluation des enfants par date'
- });
-}
-
-
-function onnextdate() {
- var tmpmonth = new Date(encodeparam(pconfig.logdate, 'date').replace(/'/g, ''));
- var nmonth = new Date(tmpmonth.getFullYear(), tmpmonth.getMonth(), tmpmonth.getDate()+1);
- pconfig.logdate = nmonth.toLocaleFormat('%d.%m.%Y');
- apppref.setpreference("pageconfig.logchild", pconfig);
- removeeditorhost();
- globelreq.send_request({
- page: 'logchild',
- module: 'logbook',
- header: 'Livret d\'évaluation des enfants par date'
- }, null);
-}
-
-function onpreviousdate() {
- var tmpmonth = new Date(encodeparam(pconfig.logdate, 'date').replace(/'/g, ''));
- var nmonth = new Date(tmpmonth.getFullYear(), tmpmonth.getMonth(), tmpmonth.getDate()-1);
- pconfig.logdate = nmonth.toLocaleFormat('%d.%m.%Y');
- apppref.setpreference("pageconfig.logchild", pconfig);
- removeeditorhost();
- globelreq.send_request({
- page: 'logchild',
- module: 'logbook',
- header: 'Livret d\'évaluation des enfants par date'
- }, null);
-}
-
-function seteditorhost(){
- //dump('BLOCK editor '+ myhostname +"->"+ $('#childloguuid').val() +"\n");
- appdb.dbexec("UPDATE childslog set editor=null where editor='"+myhostname+"';");
- appdb.dbexec("UPDATE childslog set editor='"+myhostname+"' where uuid='"+$('#childloguuid').val()+"';");
- //load_logchild_table();
-}
-//
-function removeeditorhost(){
- appdb.dbexec("UPDATE childslog set editor=null where editor='"+myhostname+"';");
- //load_logchild_table();
-}
-
-
-
-function confirm_delete_protection(){
- $("#confirm_delete_protection").modal('show');
-}
-
-function delete_protection(){
- appdb.dbexec("UPDATE childslog set editor=null where uuid='"+$('#childloguuid').val()+"';");
- $('#editorhost').html('');
- $('#btneditorhost').removeClass('btn-danger');
- $('#btneditorhost').addClass('btn-default');
- $('#btnprotection').hide();
- load_logchild_table();
- $("#confirm_delete_protection").modal('hide');
-}
+++ /dev/null
-//Source-code licensed under EUPL v1.1 ( Copyright 2016 By DKS s.à r.l. - Kilian Saffran - Luxembourg )
-var pconfig = {};
-var winh= window.innerHeight -170;
-var tbllog = null;
-var crecheuuid = null;
-var initdate = new Date();
-var xcurdate = new Date();
-var deluuid = "";
-var amonth = ['', 'Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Aôut', 'Septembre', 'Octobre','Novembre', 'Décembre'];
-var myhostname = system.hostname();
-
-function initdata(){
-
- load_helpers();
- var configdata = apppref.getpreference("pageconfig.logcominterne");
- //dump("cfdata:" + configdata +"\n");
- if ((configdata) && (configdata !== '')){
- pconfig = JSON.parse(configdata);
- }
-
- pconfig.printlayout = 'book';
- apppref.setpreference("pageconfig.logcominterne",pconfig);
-
- var ccreche = appdb.dbquery("select uuid from creche LIMIT 1;");
- crecheuuid = ccreche.sqldata[0].uuid;
- var edith = 270;
- myhostname = system.hostname();
- //dump("Current Hostname:" + myhostname + "\n");
- loadtextareas(edith);
- if (pconfig.logmonth) {
-
- initdate = new Date(encodeparam(pconfig.logmonth, 'month').replace(/'/g, ''));
- $("#logmonth").val(pconfig.logmonth);
- } else {
- $("#logmonth").val(initdate.toLocaleFormat('%m.%Y'));
-
- pconfig.logmonth=initdate.toLocaleFormat("%m.%Y");
- apppref.setpreference("pageconfig.logcominterne",pconfig);
- }
- var acttitle = "";
- if (pconfig.activityuuid){
- var chdata = appdb.dbquery("select logtitle from messagelog where uuid='"+ pconfig.messageuuid +"'");
- if (chdata.sqldata.length > 0){
- acttitle = chdata.sqldata[0].logtitle + " - ";
- }
- }
- if (xcurdate.toLocaleFormat("%m.%Y") == pconfig.logmonth){
- $('#btnaddmessage').show();
- } else{
- $('#btnaddmessage').hide();
- }
- set_infoheader(acttitle + " Mois: " + amonth[parseInt(pconfig.logmonth.substring(0, 3))] + " " + pconfig.logmonth.substring(3, 8));
- $('#logmonth').on('dp.hide', function(e) {
- set_logmonth();
- });
- $("#btnedit").hide();
- $("#btnprotection").hide();
- $("#btndelete").hide();
- load_logmessage_table();
-
-}
-
-function seteditorhost(){
- //dump('BLOCK editor '+ myhostname +"->"+ $('#loguuid').val() +"\n");
- appdb.dbexec("UPDATE messagelog set editor=null where editor='"+myhostname+"';");
- appdb.dbexec("UPDATE messagelog set editor='"+myhostname+"' where uuid='"+$('#cominterneloguuid').val()+"';");
- load_logmessage_table();
-}
-
-function removeeditorhost(){
- appdb.dbexec("UPDATE messagelog set editor=null where editor='"+myhostname+"';");
- load_logmessage_table();
-}
-
-
-function load_logmessage_table(){
- var mins = initdate.getTimezoneOffset() * -1;//dump("cur timezoneoffset:" + + "\n");
- if (mins > 0){
- mins = '+' + mins;
- }
- var logsql = "SELECT uuid, logtitle,'<span style=\"display:none\">' || logdate || '</span>' || strftime('%d.%m.%Y',logdate) as logdate,'<span style=\"display:none\">' || lastmodified || '</span>' || strftime('%d.%m.%Y %H:%M',lastmodified,'"+mins+" minutes') as lastmodified,editor FROM messagelog where date(logdate) between date('"+initdate.toLocaleFormat("%Y-%m")+"-01') and date('"+initdate.toLocaleFormat("%Y-%m")+"-01','+1 month','-1 day');";
- var logdata = appdb.dbquery(logsql);
- var headerdata = getlabels("subject,daydate,lastmodified,editor");
- $("#tbl_logcominterne").html("");
- //tbllog = null;
- var tblheader = '<tr>';
-
- for (var h in headerdata){
- if ((headerdata[h].keyname == 'act') && (headerdata[h].class.indexOf('action1btn') == -1)){
- headerdata[h].class +=" action1btn";
- }
-
- tblheader += '<th class="' + headerdata[h].class +'">'+ headerdata[h].title+'</th>';
-
- }
- tblheader += '</tr>';
-
-
- $("#tbl_logcominterne").append("<thead>" + tblheader + "</thead>");
- $("#tbl_logcominterne").append("<tfoot>" + tblheader + "</tfoot>");
- $("#tbl_logcominterne").append("<tbody>");
-
-
- for (var i in logdata.sqldata){
- var sel = "";
- var row = logdata.sqldata[i];
- if (pconfig.messageuuid && row.uuid == pconfig.messageuuid) {
- sel = "selected";
- load_messagelog();
- }
-
- var tr = '<tr data-message="'+ row.uuid+'" class="'+ sel+'"><td>' + row.logtitle + '</td>'+
- '<td>' + row.logdate + '</td>'+
- '<td>'+ row.lastmodified+'</td>'+
- '<td>'+ row.editor +'</td>'+
- '</tr>';
-
- $("#tbl_logcominterne").append(tr);
- }
-
- $("#tbl_logcominterne").append("</tbody>");
-
-
- tbllog = $("#tbl_logcominterne").dataTable({
- "language": {
- "url": "../../web/js/locale/datatable_fr.json"
- },
- "paging": false,
- "ordering": true,
- "bAutoWidth": false,
- "scrollY": winh + "px",
- "scrollCollapse": true,
- "info": false,
- "filter": false,
- "destroy": true,
- });
-
-
-
- $('#tbl_logcominterne').on( 'order.dt', function () {
- pconfig.order= tbllog.fnSettings().aaSorting;
- apppref.setpreference("pageconfig.logcominterne",pconfig);
-
- } );
-
- if (pconfig.order) {
-
- tbllog.fnSort(pconfig.order);
- }
-
-
-
-$('#tbl_logcominterne tbody').on( 'click', 'tr', function () {
- //dump("select activity\n");
- if ( $(this).hasClass('selected') ) {
- // $(this).removeClass('selected');
- }
- else {
- $("#btnedit").hide();
- $("#btnprotection").hide();
- $("#btndelete").hide();
- tbllog.$('tr.selected').removeClass('selected');
- $(this).addClass('selected');
- var curmessage = $(this).attr('data-message');
- //setforeigneditor($(this).attr('data-editor'));
- pconfig.messageuuid = curmessage;
- var cilogsql = "SELECT editor FROM messagelog where uuid='"+ pconfig.messageuuid+"';";
- var cdata = appdb.dbquery(cilogsql);
- if (cdata.sqldata[0].editor == '' || cdata.sqldata[0].editor == myhostname){
- $("#btnedit").show();
- $("#btndelete").show();
- }
- if (cdata.sqldata[0].editor != '' && cdata.sqldata[0].editor != myhostname){
- $("#btnprotection").show();
- }
- apppref.setpreference("pageconfig.logcominterne",pconfig);
- load_messagelog();
- }
- } );
-}
-
-function newlogmessage(){
- var nuuid = appdb.generate_uuid();
- var sql = "INSERT INTO messagelog (uuid,logtitle,logdate) VALUES ('"+nuuid+"','nouveau message',date('"+xcurdate.toLocaleFormat('%Y-%m-%d')+"'));";
- //dump(sql + "\n");
- appdb.dbexec(sql);
- pconfig.messageuuid=nuuid;
- apppref.setpreference("pageconfig.logcominterne",pconfig);
- edit_cominternelog();
-}
-
-function edit_cominternelog(){
- var actlogsql = "SELECT uuid, strftime('%d.%m.%Y',logdate) as logdate, logtitle, logmessage,editor FROM messagelog where uuid='"+ pconfig.messageuuid+"';";
- var adata = appdb.dbquery(actlogsql);
- //dump("EDIT: " + JSON.stringify(chdata) + "\n");
- if ((adata.sqldata[0].editor != '') && (adata.sqldata[0].editor != myhostname)){
- system.popup("cette communication est bloqué par l'editeur: " + adata.sqldata[0].editor);
- load_logmessage_table();
- return;
- }
- seteditorhost();
- if (adata.sqldata.length > 0){
- $('#frmeditcominterne #loguuid').val(adata.sqldata[0].uuid);
- $("#frmeditcominterne #logtitle").val(adata.sqldata[0].logtitle);
- $("#frmeditcominterne #logdate").val(adata.sqldata[0].logdate);
- $("#frmeditcominterne #logmessage").summernote('reset');
- $("#frmeditcominterne #logmessage").summernote('code',htmlUnescape(adata.sqldata[0].logmessage));
- }
- $("#edit_cominternelog").modal('show');
-}
-
-function load_messagelog(){
- $("#btnedit").hide();
- $("#btnprotection").hide();
- $("#btndelete").hide();
- var actlogsql = "SELECT uuid, strftime('%d.%m.%Y',logdate) as logdate, logtitle, logmessage,editor FROM messagelog where uuid='"+ pconfig.messageuuid+"';";
- var adata = appdb.dbquery(actlogsql);
- //dump(childlogsql + " -> " +JSON.stringify(chdata) + "\n");
- var inftitle = "";
- if (adata.sqldata.length > 0){
- //dump("load data from db\n");
- $("#cominterneloguuid").val(adata.sqldata[0].uuid);
- $("#cominternelogmessage").html(htmlUnescape(adata.sqldata[0].logmessage));
- $("#cominternelogtitle").html(adata.sqldata[0].logtitle);
- $("#cominternelogdate").html(adata.sqldata[0].logdate);
- if (adata.sqldata[0].editor == '' || adata.sqldata[0].editor == myhostname){
- $("#btnedit").show();
- $("#btndelete").show();
- }
- if (adata.sqldata[0].editor != '' && adata.sqldata[0].editor != myhostname){
- $("#btnprotection").show();
- }
- inftitle=adata.sqldata[0].logtitle;
- }else {
- //dump("set data to empty fields\n");
- $("#cominterneloguuid").val('0');
- $("#cominternelogmessage").html("");
- $("#cominternelogtitle").html("");
- $("#cominternelogdate").html("");
-
- }
-
- set_infoheader(inftitle + " Mois: " + amonth[parseInt(pconfig.logmonth.substring(0, 3))] + " " + pconfig.logmonth.substring(3, 8));
-
-}
-
-function save_cominternelog(){
- var ld = encodeparam($("#frmeditcominterne #logdate").val(),"date");
- $("#cominterneloguuid").val($("#frmeditcominterne #loguuid").val());
- //var tmpdate = encodeparam(pconfig.logdate, 'date').replace(/'/g, '');
- var lsql = "UPDATE messagelog set logtitle="+encodeparam($('#frmeditcominterne #logtitle').val(),"text")+
- ",logmessage="+encodeparam($('#frmeditcominterne #logmessage').val(),"richtextarea")+
- ",logdate=date("+ld+") where uuid='"+$("#frmeditcominterne #loguuid").val()+"';";
- //dump("SV cominterne: "+ lsql + "\n");
- appdb.dbexec(lsql);
- removeeditorhost();
- $("#edit_cominternelog").modal('hide');
- //load_logmessage_table();
- load_messagelog();
-
-}
-
-function confirm_delete_cominterne() {
-
- deluuid = $("#cominterneloguuid").val();
- $('#confirm_delete_logcominterne').modal('show');
-}
-
-function delete_logcominterne() {
- appdb.dbexec("delete from messagelog where uuid='"+ deluuid+"';");
- load_logmessage_table();
- $('#confirm_delete_logcominterne').modal('hide');
-}
-
-function onnextmonth() {
- var tmpmonth = new Date(encodeparam(pconfig.logmonth, 'month').replace(/'/g, ''));
- var nmonth = new Date(tmpmonth.getFullYear(), tmpmonth.getMonth() + 1, tmpmonth.getDate());
- pconfig.logmonth = nmonth.toLocaleFormat('%m.%Y');
- apppref.setpreference("pageconfig.logcominterne", pconfig);
- removeeditorhost();
- //dump("Next Month:" +JSON.stringify(pconfig) + "\n");
- globelreq.send_request({
- page: 'logcominterne',
- module: 'logbook',
- header: 'Communication interne'
- }, null);
-}
-
-function onpreviousmonth() {
- var tmpmonth = new Date(encodeparam(pconfig.logmonth, 'month').replace(/'/g, ''));
- var nmonth = new Date(tmpmonth.getFullYear(), tmpmonth.getMonth() - 1, tmpmonth.getDate());
- pconfig.logmonth = nmonth.toLocaleFormat('%m.%Y');
- apppref.setpreference("pageconfig.logcominterne", pconfig);
- removeeditorhost();
- //dump("previous Month:" +JSON.stringify(pconfig) + "\n");
- globelreq.send_request({
- page: 'logcominterne',
- module: 'logbook',
- header: 'Communication interne'
- }, null);
-}
-
-function set_logmonth(){
- pconfig.logmonth =$("#logmonth").val();
- apppref.setpreference("pageconfig.logcominterne",pconfig);
- removeeditorhost();
- //dump("Set Month:" +JSON.stringify(pconfig) + "\n");
- globelreq.send_request({
- page: 'logcominterne',
- module: 'logbook',
- header: 'Communication interne'
- });
-}
-
-function confirm_delete_protection(){
- $("#confirm_delete_protection").modal('show');
-}
-
-function delete_protection(){
- //dump("DELPROT: UPDATE messagelog set editor=null where uuid='"+$('#loguuid').val()+"';\n");
- appdb.dbexec("UPDATE messagelog set editor=null where uuid='"+$('#cominterneloguuid').val()+"';");
- $('#editorhost').html('');
- $('#btneditorhost').removeClass('btn-danger');
- $('#btneditorhost').addClass('btn-default');
- $('#btnprotection').hide();
- load_logmessage_table();
- $("#confirm_delete_protection").modal('hide');
-}
\ No newline at end of file
+++ /dev/null
-//Source-code licensed under EUPL v1.1 ( Copyright 2016 By DKS s.à r.l. - Kilian Saffran - Luxembourg )
-var pconfig = {};
-var winh= window.innerHeight -170;
-var tbllog = null;
-var crecheuuid = null;
-var initdate = new Date();
-var xcurdate = new Date();
-var deluuid = "";
-var amonth = ['', 'Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Aôut', 'Septembre', 'Octobre','Novembre', 'Décembre'];
-var myhostname = system.hostname();
-
-function initdata(){
-
- load_helpers();
- var configdata = apppref.getpreference("pageconfig.logcominterne");
- //dump("cfdata:" + configdata +"\n");
- if ((configdata) && (configdata !== '')){
- pconfig = JSON.parse(configdata);
- }
-
- pconfig.printlayout = 'book';
- apppref.setpreference("pageconfig.logcominterne",pconfig);
-
- var ccreche = appdb.dbquery("select uuid from creche LIMIT 1;");
- crecheuuid = ccreche.sqldata[0].uuid;
- var edith = 270;
- myhostname = system.hostname();
- //dump("Current Hostname:" + myhostname + "\n");
- loadtextareas(edith);
- if (pconfig.logmonth) {
-
- initdate = new Date(encodeparam(pconfig.logmonth, 'month').replace(/'/g, ''));
- $("#logmonth").val(pconfig.logmonth);
- } else {
- $("#logmonth").val(initdate.toLocaleFormat('%m.%Y'));
-
- pconfig.logmonth=initdate.toLocaleFormat("%m.%Y");
- apppref.setpreference("pageconfig.logcominterne",pconfig);
- }
- var acttitle = "";
- if (pconfig.activityuuid){
- var chdata = appdb.dbquery("select logtitle from messagelog where uuid='"+ pconfig.messageuuid +"'");
- if (chdata.sqldata.length > 0){
- acttitle = chdata.sqldata[0].logtitle + " - ";
- }
- }
- if (xcurdate.toLocaleFormat("%m.%Y") == pconfig.logmonth){
- $('#btnaddmessage').show();
- } else{
- $('#btnaddmessage').hide();
- }
- set_infoheader(acttitle + " Mois: " + amonth[parseInt(pconfig.logmonth.substring(0, 3))] + " " + pconfig.logmonth.substring(3, 8));
- $('#logmonth').on('dp.hide', function(e) {
- set_logmonth();
- });
- $("#btnedit").hide();
- load_logmessage_table();
-
-}
-
-function seteditorhost(){
- //dump('BLOCK editor '+ myhostname +"->"+ $('#loguuid').val() +"\n");
- appdb.dbexec("UPDATE messagelog set editor=null where editor='"+myhostname+"';");
- appdb.dbexec("UPDATE messagelog set editor='"+myhostname+"' where uuid='"+$('#loguuid').val()+"';");
- load_logmessage_table();
-}
-
-function removeeditorhost(){
- appdb.dbexec("UPDATE messagelog set editor=null where editor='"+myhostname+"';");
- load_logmessage_table();
-}
-
-
-function load_logmessage_table(){
- var mins = initdate.getTimezoneOffset() * -1;//dump("cur timezoneoffset:" + + "\n");
- if (mins > 0){
- mins = '+' + mins;
- }
- var logsql = "SELECT uuid, logtitle,'<span style=\"display:none\">' || logdate || '</span>' || strftime('%d.%m.%Y',logdate) as logdate,'<span style=\"display:none\">' || lastmodified || '</span>' || strftime('%d.%m.%Y %H:%M',lastmodified,'"+mins+" minutes') as lastmodified,editor FROM messagelog where date(logdate) between date('"+initdate.toLocaleFormat("%Y-%m")+"-01') and date('"+initdate.toLocaleFormat("%Y-%m")+"-01','+1 month','-1 day');";
- var logdata = appdb.dbquery(logsql);
- var headerdata = getlabels("subject,daydate,lastmodified,editor");
- $("#tbl_logcominterne").html("");
- //tbllog = null;
- var tblheader = '<tr>';
-
- for (var h in headerdata){
- if ((headerdata[h].keyname == 'act') && (headerdata[h].class.indexOf('action1btn') == -1)){
- headerdata[h].class +=" action1btn";
- }
-
- tblheader += '<th class="' + headerdata[h].class +'">'+ headerdata[h].title+'</th>';
-
- }
- tblheader += '</tr>';
-
-
- $("#tbl_logcominterne").append("<thead>" + tblheader + "</thead>");
- $("#tbl_logcominterne").append("<tfoot>" + tblheader + "</tfoot>");
- $("#tbl_logcominterne").append("<tbody>");
-
-
- for (var i in logdata.sqldata){
- var sel = "";
- var row = logdata.sqldata[i];
- if (pconfig.messageuuid && row.uuid == pconfig.messageuuid) {
- sel = "selected";
- load_messagelog();
- }
-
- var tr = '<tr data-message="'+ row.uuid+'" class="'+ sel+'"><td>' + row.logtitle + '</td>'+
- '<td>' + row.logdate + '</td>'+
- '<td>'+ row.lastmodified+'</td>'+
- '<td>'+ row.editor +'</td>'+
- '</tr>';
-
- $("#tbl_logcominterne").append(tr);
- }
-
- $("#tbl_logcominterne").append("</tbody>");
-
-
- tbllog = $("#tbl_logcominterne").dataTable({
- "language": {
- "url": "../../web/js/locale/datatable_fr.json"
- },
- "paging": false,
- "ordering": true,
- "bAutoWidth": false,
- "scrollY": winh + "px",
- "scrollCollapse": true,
- "info": false,
- "filter": false,
- "destroy": true,
- });
-
-
-
- $('#tbl_logcominterne').on( 'order.dt', function () {
- pconfig.order= tbllog.fnSettings().aaSorting;
- apppref.setpreference("pageconfig.logcominterne",pconfig);
-
- } );
-
- if (pconfig.order) {
-
- tbllog.fnSort(pconfig.order);
- }
-
-
-
-$('#tbl_logcominterne tbody').on( 'click', 'tr', function () {
- //dump("select activity\n");
- if ( $(this).hasClass('selected') ) {
- // $(this).removeClass('selected');
- }
- else {
- $("#btnedit").hide();
- tbllog.$('tr.selected').removeClass('selected');
- $(this).addClass('selected');
- var curmessage = $(this).attr('data-message');
- //setforeigneditor($(this).attr('data-editor'));
- pconfig.messageuuid = curmessage;
- var cilogsql = "SELECT editor FROM messagelog where uuid='"+ pconfig.messageuuid+"';";
- var cdata = appdb.dbquery(cilogsql);
- if (cdata.sqldata[0].editor == '' || cdata.sqldata[0].editor == myhostname){
- $("#btnedit").show();
-
- }
-
- apppref.setpreference("pageconfig.logcominterne",pconfig);
- load_messagelog();
- }
- } );
-}
-
-function newlogmessage(){
- var nuuid = appdb.generate_uuid();
- var sql = "INSERT INTO messagelog (uuid,logtitle,logdate) VALUES ('"+nuuid+"','nouveau message',date('"+xcurdate.toLocaleFormat('%Y-%m-%d')+"'));";
- //dump(sql + "\n");
- appdb.dbexec(sql);
- pconfig.messageuuid=nuuid;
- apppref.setpreference("pageconfig.logcominterne",pconfig);
- edit_cominternelog();
-}
-
-function edit_cominternelog(){
- var actlogsql = "SELECT uuid, strftime('%d.%m.%Y',logdate) as logdate, logtitle, logmessage,editor FROM messagelog where uuid='"+ pconfig.messageuuid+"';";
- var adata = appdb.dbquery(actlogsql);
- if ((adata.sqldata[0].editor != '') && (adata.sqldata[0].editor != myhostname)){
- system.popup("cette communication est bloqué par l'editeur: " + adata.sqldata[0].editor);
- load_logmessage_table();
- return;
- }
- //dump("EDIT: " + JSON.stringify(chdata) + "\n");
- seteditorhost();
- if (adata.sqldata.length > 0){
- $('#frmeditcominterne #loguuid').val(adata.sqldata[0].uuid);
- $("#frmeditcominterne #logtitle").val(adata.sqldata[0].logtitle);
- $("#frmeditcominterne #logdate").val(adata.sqldata[0].logdate);
- $("#frmeditcominterne #logmessage").summernote('reset');
- $("#frmeditcominterne #logmessage").summernote('code',htmlUnescape(adata.sqldata[0].logmessage));
- }
- $("#edit_cominternelog").modal('show');
-}
-
-function load_messagelog(){
- $("#btnedit").hide();
- $("#btnprotection").hide();
- $("#btndelete").hide();
- var actlogsql = "SELECT uuid, strftime('%d.%m.%Y',logdate) as logdate, logtitle, logmessage,editor FROM messagelog where uuid='"+ pconfig.messageuuid+"';";
- var adata = appdb.dbquery(actlogsql);
- //dump(childlogsql + " -> " +JSON.stringify(chdata) + "\n");
- var inftitle = "";
- if (adata.sqldata.length > 0){
- //dump("load data from db\n");
- $("#cominterneloguuid").val(adata.sqldata[0].uuid);
- $("#cominternelogmessage").html(htmlUnescape(adata.sqldata[0].logmessage));
- $("#cominternelogtitle").html(adata.sqldata[0].logtitle);
- $("#cominternelogdate").html(adata.sqldata[0].logdate);
- if (adata.sqldata[0].editor == '' || adata.sqldata[0].editor == myhostname){
- $("#btnedit").show();
- $("#btndelete").show();
- }
- if (adata.sqldata[0].editor != '' && adata.sqldata[0].editor != myhostname){
- $("#btnprotection").show();
- }
- inftitle=adata.sqldata[0].logtitle;
- }else {
- //dump("set data to empty fields\n");
- $("#cominterneloguuid").val('0');
- $("#cominternelogmessage").html("");
- $("#cominternelogtitle").html("");
- $("#cominternelogdate").html("");
-
- }
-
- set_infoheader(inftitle + " Mois: " + amonth[parseInt(pconfig.logmonth.substring(0, 3))] + " " + pconfig.logmonth.substring(3, 8));
-
-}
-
-function save_cominternelog(){
- var ld = encodeparam($("#frmeditcominterne #logdate").val(),"date");
- $("#cominterneloguuid").val($("#frmeditcominterne #loguuid").val());
- //var tmpdate = encodeparam(pconfig.logdate, 'date').replace(/'/g, '');
- var lsql = "UPDATE messagelog set logtitle="+encodeparam($('#frmeditcominterne #logtitle').val(),"text")+
- ",logmessage="+encodeparam($('#frmeditcominterne #logmessage').val(),"richtextarea")+
- ",logdate=date("+ld+") where uuid='"+$("#frmeditcominterne #loguuid").val()+"';";
- //dump("SV cominterne: "+ lsql + "\n");
- appdb.dbexec(lsql);
- removeeditorhost();
- $("#edit_cominternelog").modal('hide');
- //load_logmessage_table();
- load_messagelog();
-
-}
-
-function onnextmonth() {
- var tmpmonth = new Date(encodeparam(pconfig.logmonth, 'month').replace(/'/g, ''));
- var nmonth = new Date(tmpmonth.getFullYear(), tmpmonth.getMonth() + 1, tmpmonth.getDate());
- pconfig.logmonth = nmonth.toLocaleFormat('%m.%Y');
- apppref.setpreference("pageconfig.logcominterne", pconfig);
- removeeditorhost();
- //dump("Next Month:" +JSON.stringify(pconfig) + "\n");
- globelreq.send_request({
- page: 'logcominterne_basic',
- module: 'logbook',
- header: 'Communication interne'
- }, null);
-}
-
-function onpreviousmonth() {
- var tmpmonth = new Date(encodeparam(pconfig.logmonth, 'month').replace(/'/g, ''));
- var nmonth = new Date(tmpmonth.getFullYear(), tmpmonth.getMonth() - 1, tmpmonth.getDate());
- pconfig.logmonth = nmonth.toLocaleFormat('%m.%Y');
- apppref.setpreference("pageconfig.logcominterne", pconfig);
- removeeditorhost();
- //dump("previous Month:" +JSON.stringify(pconfig) + "\n");
- globelreq.send_request({
- page: 'logcominterne_basic',
- module: 'logbook',
- header: 'Communication interne'
- }, null);
-}
-
-function set_logmonth(){
- pconfig.logmonth =$("#logmonth").val();
- apppref.setpreference("pageconfig.logcominterne",pconfig);
- removeeditorhost();
- //dump("Set Month:" +JSON.stringify(pconfig) + "\n");
- globelreq.send_request({
- page: 'logcominterne_basic',
- module: 'logbook',
- header: 'Communication interne'
- });
-}
-
+++ /dev/null
-//Source-code licensed under EUPL v1.1 ( Copyright 2016 By DKS s.à r.l. - Kilian Saffran - Luxembourg )
\ No newline at end of file
+++ /dev/null
-<!DOCTYPE html>
-
-<html lang="fr">
-<head>
- <meta charset="utf-8">
- <title>Livret des activités</title>
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <meta http-equiv="cache-control" content="max-age=0" />
- <meta http-equiv="cache-control" content="no-cache" />
- <meta http-equiv="expires" content="0" />
- <meta http-equiv="expires" content="Tue, 01 Jan 1970 1:00:00 GMT" />
- <meta http-equiv="pragma" content="no-cache" />
- <link href="../../web/css/bootstrap.min.css" rel="stylesheet" type="text/css">
- <!--<link href="../../web/css/bootstrap-theme.min.css" rel="stylesheet" type="text/css">-->
- <link href="../../web/css/datatables.min.css" rel="stylesheet" type="text/css">
- <link href="../../web/css/dataTables.bootstrap.min.css" rel="stylesheet" type="text/css">
- <link href="../../web/css/bootstrap-datetimepicker.min.css" rel="stylesheet" type="text/css">
- <!-- <link href="../../web/css/bootstrap-timepicker.min.css" rel="stylesheet" type="text/css"> -->
- <link href="../../web/css/bootstrap-multiselect.css" rel="stylesheet" type="text/css">
- <link href="../../web/css/glyphicons.css" rel="stylesheet" type="text/css">
- <link href="../../web/css/summernote.css" rel="stylesheet" type="text/css">
- <link href="../../web/css/creorga.css" rel="stylesheet" type="text/css">
- <style type="text/css">
- .dataTables_filter {
- margin-top: 15px;
- }
- </style>
-</head>
-
-<body>
- <div class="container-fluid" style="padding-top: 5px;">
- <div class="form-inline" >
- <div class="input-group month btn-group">
- <span class="input-group-addon">du mois:</span>
- <input type="date" class="form-control" value="" placeholder="mm.yyyy" style="width: 80px;" id="logmonth">
- <span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
- </div>
- <button class="btn btn-primary" onclick="onpreviousmonth();"><span class="glyphicon glyphicon-chevron-left"></span></button>
- <button class="btn btn-primary" onclick="onnextmonth();"><span class="glyphicon glyphicon-chevron-right"></span></button>
- <button class="btn btn-primary" onclick="newlogactivity();"><span class="glyphicon glyphicon-plus"></span> Activité</button>
-
- </div>
- <div>
- <table style="height: calc(100vh - 100px); width: 100%; ">
- <tbody>
- <tr>
- <td style="width: 550px; vertical-align: top;"><table class="display dataTable cell-border" style="width: 100%;" id="tbl_logactivity" role="grid"></table></td>
- <td style="vertical-align: top; margin-left: 30px;">
- <div class="form-inline" style="margin-top: 15px; margin-bottom: 10px; margin-left: 10px;">
- <button class="btn btn-success" onclick="edit_activitylog();" id="btnedit"><span class="glyphicon glyphicon-pencil"></span> éditer</button>
- <button class="btn btn-danger" onclick="confirm_delete_activity();" id="btndelete"><span class="glyphicon glyphicon-remove"></span> supprimer</button>
- <button class="btn btn-warning" onclick="confirm_delete_protection();" id="btnprotection"><span class="glyphicon glyphicon-remove"></span> Protection</button>
- </div>
- <input type="hidden" id="activityloguuid" value="0">
-
- <div><strong>Titre:</strong> <span id="activitylogtitle"></span></div>
- <div><strong>Date: </strong><span id="activitylogdatefrom"></span> <strong>au</strong> <span id="activitylogdateto"></span></div>
-
- <div style="width: 100%; height: calc(100vh - 200px); background-color: #fff; border: 1px solid grey; border-radius: 10px; display: block; overflow-y: auto; padding: 5px; margin: 5px;" id="activitylogmessage"></div></td>
- </tr>
- </tbody>
- </table>
- </div>
- <div class="modal fade" id="confirm_delete_logactivity">
- <div class="modal-dialog">
- <div class="modal-content">
- <div class="modal-header">
- <button data-dismiss="modal" class="close" type="button"><span aria-hidden="true">x</span><span class="sr-only">Close</span></button>
-
- <h4 class="modal-title">Supprimer Activité</h4>
- </div><!-- dialog contents -->
-
- <div class="modal-body">
- Êtes vous sûre de supprimer cette activité?<br>
-
- </div><!-- dialog buttons -->
-
- <div class="modal-footer">
- <button aria-hidden="true" data-dismiss="modal" class="btn">Non</button> <button onclick="delete_logactivity();" class="btn btn-primary">Oui</button>
- </div>
- </div>
- </div>
- </div>
- <div class="modal fade" id="confirm_delete_protection">
- <div class="modal-dialog">
- <div class="modal-content">
- <div class="modal-header">
- <button data-dismiss="modal" class="close" type="button"><span aria-hidden="true">x</span><span class="sr-only">Close</span></button>
-
- <h4 class="modal-title">Supprimer Protection</h4>
- </div><!-- dialog contents -->
-
- <div class="modal-body">
- Êtes vous sûre de supprimer cette protection?<br>
- (possibilité de perdre des données pas sauvegardées)
- </div><!-- dialog buttons -->
-
- <div class="modal-footer">
- <button aria-hidden="true" data-dismiss="modal" class="btn">Non</button> <button onclick="delete_protection();" class="btn btn-primary">Oui</button>
- </div>
- </div>
- </div>
- </div>
- <div class="modal fade" id="edit_activitylog">
- <div class="modal-dialog" style="width: 1000px; min-width: 1000px;">
- <div class="modal-content" >
- <div class="modal-header">
- <button data-dismiss="modal" class="close" type="button"><span aria-hidden="true">x</span><span class="sr-only">Close</span></button>
- <h4 class="modal-title">Editer activité</h4>
- </div>
- <div class="modal-body" style=" height: 80vh; max-height: height: 80vh; ">
-
- <div id="frmeditactivitylog">
- <input type="hidden" id="loguuid" value="0">
- <div class="row form-inline" style="margin-left: 30px;">
- <label for="logtitle">Titre</label> <input type="text" value="" style="width: 80%;" id="logtitle" class="form-control">
- </div>
- <div class="row" style="margin-left: 30px;">
- <div class="form-inline" id="date-container">
- <label for="logdatefrom" style="width: 200px;">Date début / fin</label>
- <div id="dt_logdatefrom" class="input-group date">
- <input type="date" class="form-control" value="00.00.0000" limits="0" placeholder="dd.mm.yyyy" id="logdatefrom"><span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
- </div>
-
- <div id="dt_logdateto" class="input-group date">
- <input type="date" class="form-control" value="00.00.0000" limits="0" placeholder="dd.mm.yyyy" id="logdateto"><span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
- </div>
- </div>
-
- </div>
- <textarea class="summernote" type="text" style="width: 100%;" id="logmessage">
-</textarea>
-
- </div>
- </div>
- <div class="modal-footer">
- <button aria-hidden="true" data-dismiss="modal" onclick="removeeditorhost();" class="btn">Annuler</button> <button onclick="save_activitylog();" class="btn btn-primary">OK</button>
- </div>
- </div>
-
-
- </div>
- </div>
- </div>
-
-
- <script src="../../web/js/jquery.min.js" type="text/javascript"></script>
- <script src="../../web/js/bootstrap.min.js" type="text/javascript"></script>
- <script src="../../web/js/datatables.min.js" type="text/javascript"></script>
- <script src="../../web/js/moment-with-locales.js" type="text/javascript"></script>
- <script src="../../web/js/bootstrap-datetimepicker.min.js" type="text/javascript"></script>
- <script src="../../web/js/bootstrap-timepicker.min.js" type="text/javascript"></script>
- <script src="../../web/js/bootstrap-multiselect.js" type="text/javascript"></script>
- <script src="../../web/js/summernote.min.js" type="text/javascript"></script>
- <script src="../../web/js/lang/summernote-fr-FR.min.js" type="text/javascript"></script>
- <script src="chrome://creorga/content/js/preferences.js" type="text/javascript"></script>
- <script src="chrome://creorga/content/js/navigation.js" type="text/javascript"></script>
- <script src="chrome://creorga/content/js/database.js" type="text/javascript"></script>
- <script src="chrome://creorga/content/js/system.js" type="text/javascript"></script>
- <script src="../../web/js/labels.js" type="text/javascript"></script>
- <script src="js/logactivity.js" type="text/javascript"></script>
- <script src="../../web/js/creorga.js" type="text/javascript"></script>
-
-</body>
-</html>
+++ /dev/null
-<!DOCTYPE html>
-
-<html lang="fr">
-<head>
- <meta charset="utf-8">
- <title>Livret des activités</title>
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <meta http-equiv="cache-control" content="max-age=0" />
- <meta http-equiv="cache-control" content="no-cache" />
- <meta http-equiv="expires" content="0" />
- <meta http-equiv="expires" content="Tue, 01 Jan 1970 1:00:00 GMT" />
- <meta http-equiv="pragma" content="no-cache" />
- <link href="../../web/css/bootstrap.min.css" rel="stylesheet" type="text/css">
- <!--<link href="../../web/css/bootstrap-theme.min.css" rel="stylesheet" type="text/css">-->
- <link href="../../web/css/datatables.min.css" rel="stylesheet" type="text/css">
- <link href="../../web/css/dataTables.bootstrap.min.css" rel="stylesheet" type="text/css">
- <link href="../../web/css/bootstrap-datetimepicker.min.css" rel="stylesheet" type="text/css">
- <!-- <link href="../../web/css/bootstrap-timepicker.min.css" rel="stylesheet" type="text/css"> -->
- <link href="../../web/css/bootstrap-multiselect.css" rel="stylesheet" type="text/css">
- <link href="../../web/css/glyphicons.css" rel="stylesheet" type="text/css">
- <link href="../../web/css/summernote.css" rel="stylesheet" type="text/css">
- <link href="../../web/css/creorga.css" rel="stylesheet" type="text/css">
- <style type="text/css">
- .dataTables_filter {
- margin-top: 15px;
- }
- </style>
-</head>
-
-<body>
- <div class="container-fluid" style="padding-top: 5px;">
- <div class="form-inline" >
- <div class="input-group month btn-group">
- <span class="input-group-addon">du mois:</span>
- <input type="date" class="form-control" value="" placeholder="mm.yyyy" style="width: 80px;" id="logmonth">
- <span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
- </div>
- <button class="btn btn-primary" onclick="onpreviousmonth();"><span class="glyphicon glyphicon-chevron-left"></span></button>
- <button class="btn btn-primary" onclick="onnextmonth();"><span class="glyphicon glyphicon-chevron-right"></span></button>
- <button class="btn btn-primary" onclick="newlogactivity();"><span class="glyphicon glyphicon-plus"></span> Activité</button>
-
- </div>
- <div>
- <table style="height: calc(100vh - 100px); width: 100%; ">
- <tbody>
- <tr>
- <td style="width: 550px; vertical-align: top;"><table class="display dataTable cell-border" style="width: 100%;" id="tbl_logactivity" role="grid"></table></td>
- <td style="vertical-align: top; margin-left: 30px;">
- <div class="form-inline" style="margin-top: 15px; margin-bottom: 10px; margin-left: 10px;">
- <button class="btn btn-success" onclick="edit_activitylog();" id="btnedit"><span class="glyphicon glyphicon-pencil"></span> éditer</button>
- </div>
- <input type="hidden" id="activityloguuid" value="0">
-
- <div><strong>Titre:</strong> <span id="activitylogtitle"></span></div>
- <div><strong>Date début: </strong><span id="activitylogdatefrom"></span> <strong>au</strong> <span id="activitylogdateto"></span></div>
-
- <div style="width: 100%; height: calc(100vh - 200px); background-color: #fff; border: 1px solid grey; border-radius: 10px; display: block; overflow-y: auto; padding: 5px; margin: 5px;" id="activitylogmessage"></div></td>
- </tr>
- </tbody>
- </table>
- </div>
-
- <div class="modal fade" id="edit_activitylog">
- <div class="modal-dialog" style="width: 1000px; min-width: 1000px;">
- <div class="modal-content" >
- <div class="modal-header">
- <button data-dismiss="modal" class="close" type="button"><span aria-hidden="true">x</span><span class="sr-only">Close</span></button>
- <h4 class="modal-title">Editer activité</h4>
- </div>
- <div class="modal-body" style=" height: 80vh; max-height: height: 80vh; ">
-
- <div id="frmeditactivitylog">
- <input type="hidden" id="loguuid" value="0">
- <div class="row form-inline" style="margin-left: 30px;">
- <label for="logtitle">Titre</label> <input type="text" value="" style="width: 80%;" id="logtitle" class="form-control">
- </div>
- <div class="row" style="margin-left: 30px;">
- <div class="form-inline" id="date-container">
- <label for="logdatefrom" style="width: 200px;">Date début / fin</label>
- <div id="dt_logdatefrom" class="input-group date">
- <input type="date" class="form-control" value="00.00.0000" limits="0" placeholder="dd.mm.yyyy" id="logdatefrom"><span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
- </div>
-
- <div id="dt_logdateto" class="input-group date">
- <input type="date" class="form-control" value="00.00.0000" limits="0" placeholder="dd.mm.yyyy" id="logdateto"><span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
- </div>
- </div>
-
- </div>
- <textarea class="summernote" type="text" style="width: 100%;" id="logmessage">
-</textarea>
-
- </div>
- </div>
- <div class="modal-footer">
- <button aria-hidden="true" data-dismiss="modal" onclick="removeeditorhost();" class="btn">Annuler</button> <button onclick="save_activitylog();" class="btn btn-primary">OK</button>
- </div>
- </div>
-
-
- </div>
- </div>
- </div>
- </div>
-
-
- <script src="../../web/js/jquery.min.js" type="text/javascript"></script>
- <script src="../../web/js/bootstrap.min.js" type="text/javascript"></script>
- <script src="../../web/js/datatables.min.js" type="text/javascript"></script>
- <script src="../../web/js/moment-with-locales.js" type="text/javascript"></script>
- <script src="../../web/js/bootstrap-datetimepicker.min.js" type="text/javascript"></script>
- <!-- <script src="../../web/js/bootstrap-timepicker.min.js" type="text/javascript"></script> -->
- <script src="../../web/js/bootstrap-multiselect.js" type="text/javascript"></script>
- <script src="../../web/js/summernote.min.js" type="text/javascript"></script>
- <script src="../../web/js/lang/summernote-fr-FR.min.js" type="text/javascript"></script>
- <script src="chrome://creorga/content/js/preferences.js" type="text/javascript"></script>
- <script src="chrome://creorga/content/js/navigation.js" type="text/javascript"></script>
- <script src="chrome://creorga/content/js/database.js" type="text/javascript"></script>
- <script src="chrome://creorga/content/js/system.js" type="text/javascript"></script>
- <script src="../../web/js/labels.js" type="text/javascript"></script>
- <script src="js/logactivity.js" type="text/javascript"></script>
- <script src="../../web/js/creorga.js" type="text/javascript"></script>
-
-</body>
-</html>
+++ /dev/null
-<?xml version="1.0"?>
-<!DOCTYPE overlay PUBLIC "-//MOZILLA//DTD XUL V1.0//EN"
-"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
-<overlay id="ov_logbook" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:html="http://www.w3.org/1999/xhtml">
- <toolbar id="co_maintoolbar" style="-moz-appearance: none;">
- <toolbarbutton type="menu" class="btn btn-default" id="tbb_logbook" insertafter="tbb_forms" label="Livrets de bord" image="modules/logbook/img/logbook.png" orient="vertical">
- <menupopup class="tlbpopup" style="text-align: left;">
-
- <label value="Enfants" style="font-weight: bold;"/>
- <menuitem label="Livret d'évaluation par date" oncommand="navigation.load_appview('logchild','logbook',null,'Livret d évaluation des enfants par date');" id="mnulogchild"/>
- <menuseparator />
- <label value="Crèche" style="font-weight: bold;"/>
- <menuitem label="Livret des activités" oncommand="navigation.load_appview('logactivity','logbook',null,'Livret des activités');" id="mnulogactivity"/>
- <menuitem label="Communication Interne" oncommand="navigation.load_appview('logcominterne','logbook',null,'Communication Interne');" id="mnulogmessage"/>
-
- </menupopup>
- </toolbarbutton>
- </toolbar>
-</overlay>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0"?>
-<!DOCTYPE overlay PUBLIC "-//MOZILLA//DTD XUL V1.0//EN"
-"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
-<overlay id="ov_logbook" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:html="http://www.w3.org/1999/xhtml">
- <toolbar id="co_maintoolbar" style="-moz-appearance: none;">
- <toolbarbutton type="menu" class="btn btn-default" id="tbb_logbook" insertafter="tbb_forms" label="Livrets de bord" image="modules/logbook/img/logbook.png" orient="vertical">
- <menupopup class="tlbpopup" style="text-align: left;">
-
- <label value="Enfants" style="font-weight: bold;"/>
- <menuitem label="Livret d'évaluation par date" oncommand="navigation.load_appview('logchild','logbook',null,'Livret d évaluation des enfants par date');" id="mnulogchild"/>
- <menuseparator />
- <label value="Crèche" style="font-weight: bold;"/>
- <menuitem label="Livret des activités" oncommand="navigation.load_appview('logactivity_basic','logbook',null,'Livret des activités');" id="mnulogactivity"/>
- <menuitem label="Communication Interne" oncommand="navigation.load_appview('logcominterne_basic','logbook',null,'Communication Interne');" id="mnulogmessage"/>
- </menupopup>
- </toolbarbutton>
- </toolbar>
-</overlay>
\ No newline at end of file
+++ /dev/null
-<!DOCTYPE html>
-
-<html lang="fr">
-<head>
- <meta charset="utf-8">
- <title>Livret d'évaluation des enfants</title>
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <meta http-equiv="cache-control" content="max-age=0" />
- <meta http-equiv="cache-control" content="no-cache" />
- <meta http-equiv="expires" content="0" />
- <meta http-equiv="expires" content="Tue, 01 Jan 1970 1:00:00 GMT" />
- <meta http-equiv="pragma" content="no-cache" />
- <link href="../../web/css/bootstrap.min.css" rel="stylesheet" type="text/css">
- <link href="../../web/css/datatables.min.css" rel="stylesheet" type="text/css">
- <link href="../../web/css/dataTables.bootstrap.min.css" rel="stylesheet" type="text/css">
- <link href="../../web/css/bootstrap-datetimepicker.min.css" rel="stylesheet" type="text/css">
- <!-- <link href="../../web/css/bootstrap-timepicker.min.css" rel="stylesheet" type="text/css"> -->
- <link href="../../web/css/bootstrap-multiselect.css" rel="stylesheet" type="text/css">
- <link href="../../web/css/glyphicons.css" rel="stylesheet" type="text/css">
- <link href="../../web/css/summernote.css" rel="stylesheet" type="text/css">
- <link href="../../web/css/creorga.css" rel="stylesheet" type="text/css">
- <style type="text/css">
- .dataTables_filter {
- margin-top: 15px;
- }
- </style>
-</head>
-
-<body>
- <div class="container-fluid" style="padding-top: 5px;">
- <div class="form-inline" >
- <div class="input-group date btn-group">
- <span class="input-group-addon">date du:</span>
- <input type="date" class="form-control" value="" placeholder="dd.mm.yyyy" style="width: 120px;" id="logdate" onchange="set_logdate();">
- <span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
- </div>
- <button class="btn btn-primary" onclick="onpreviousdate();"><span class="glyphicon glyphicon-chevron-left"></span></button>
- <button class="btn btn-primary" onclick="onnextdate();"><span class="glyphicon glyphicon-chevron-right"></span></button>
- <!--<button class="btn btn-default" id="btneditorhost">Editeur: <span id="editorhost"></span></button>
- <button class="btn btn-danger" id="btnprotection" onclick="confirm_delete_protection();" style="display: none;"><span class="glyphicon glyphicon-remove"></span> protection</button>-->
- </div>
- <div>
- <table style="height: calc(100vh - 100px); width: 100%;">
- <tbody>
- <tr>
- <td style="width: 600px; vertical-align: top; padding-top: 0px;"><table class="display dataTable cell-border" style="width: 100%;" id="tbl_logchild" role="grid"></table></td>
- <td style="vertical-align: top; padding-top: 0px; ">
- <input type="hidden" id="childloguuid" value="0">
- <div class="form-inline" style="margin-top: 15px; margin-bottom: 10px; margin-left: 10px;">
- <button class="btn btn-primary" onclick="addchildlog();" id="btnadd"><span class="glyphicon glyphicon-plus"></span> ajouter</button>
- <button class="btn btn-success" onclick="edit_childlog();" id="btnedit"><span class="glyphicon glyphicon-pencil"></span> éditer</button>
- <button class="btn btn-warning" onclick="confirm_delete_protection();" id="btnprotection"><span class="glyphicon glyphicon-remove"></span> Protection</button>
- </div>
- <div style="width: 100%; height: calc(100vh - 150px); background-color: #fff; border: 1px solid grey; border-radius: 10px; display: block; overflow-y: auto; padding: 5px; margin: 5px;" id="childlogmessage"></div>
- </td>
- </tr>
- </tbody>
- </table>
-
- </div>
- <div class="modal fade" id="confirm_delete_protection">
- <div class="modal-dialog">
- <div class="modal-content">
- <div class="modal-header">
- <button data-dismiss="modal" class="close" type="button"><span aria-hidden="true">x</span><span class="sr-only">Close</span></button>
-
- <h4 class="modal-title">Supprimer Protection</h4>
- </div><!-- dialog contents -->
-
- <div class="modal-body">
- Êtes vous sûre de supprimer cette protection?<br>
- (possibilité de perdre des données pas sauvegardées)
- </div><!-- dialog buttons -->
-
- <div class="modal-footer">
- <button aria-hidden="true" data-dismiss="modal" class="btn">Non</button> <button onclick="delete_protection();" class="btn btn-primary">Oui</button>
- </div>
- </div>
- </div>
- </div>
- <div class="modal fade" id="edit_childlog">
- <div class="modal-dialog" style="width: 1000px; min-width: 1000px;">
- <div class="modal-content" >
- <div class="modal-header">
- <button data-dismiss="modal" class="close" type="button"><span aria-hidden="true">x</span><span class="sr-only">Close</span></button>
- <h4 class="modal-title">Editer livret d'évaluation</h4>
- </div>
- <div class="modal-body" style=" height: 700px; max-height: 700px ">
-
- <div id="frmeditchildlog">
- <input type="hidden" value="0" id="uuid" />
- <input type="hidden" value="0" id="childuuid" />
- <textarea style="height: 600px;" class="summernote" type="text" id="logmessage"></textarea>
-
- </div>
- </div>
- <div class="modal-footer">
- <button aria-hidden="true" data-dismiss="modal" onclick="removeeditorhost();" class="btn">Annuler</button> <button onclick="save_childlog();" class="btn btn-primary">OK</button>
- </div>
- </div>
-
-
- </div>
- </div>
- </div>
-
-
- <script src="../../web/js/jquery.min.js" type="text/javascript"></script>
- <script src="../../web/js/bootstrap.min.js" type="text/javascript"></script>
- <script src="../../web/js/datatables.min.js" type="text/javascript"></script>
- <script src="../../web/js/moment-with-locales.js" type="text/javascript"></script>
- <script src="../../web/js/bootstrap-datetimepicker.min.js" type="text/javascript"></script>
- <!-- <script src="../../web/js/bootstrap-timepicker.min.js" type="text/javascript"></script> -->
- <script src="../../web/js/bootstrap-multiselect.js" type="text/javascript"></script>
- <script src="../../web/js/summernote.min.js" type="text/javascript"></script>
- <script src="../../web/js/lang/summernote-fr-FR.min.js" type="text/javascript"></script>
- <script src="chrome://creorga/content/js/navigation.js" type="text/javascript"></script>
- <script src="chrome://creorga/content/js/preferences.js" type="text/javascript"></script>
- <script src="chrome://creorga/content/js/system.js" type="text/javascript"></script>
- <script src="chrome://creorga/content/js/database.js" type="text/javascript"></script>
- <script src="../../web/js/labels.js" type="text/javascript"></script>
- <script src="js/logchild.js" type="text/javascript"></script>
- <script src="../../web/js/creorga.js" type="text/javascript"></script>
-
-</body>
-</html>
+++ /dev/null
-<!DOCTYPE html>
-
-<html lang="fr">
-<head>
- <meta charset="utf-8">
- <title>Communication interne</title>
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <meta http-equiv="cache-control" content="max-age=0" />
- <meta http-equiv="cache-control" content="no-cache" />
- <meta http-equiv="expires" content="0" />
- <meta http-equiv="expires" content="Tue, 01 Jan 1970 1:00:00 GMT" />
- <meta http-equiv="pragma" content="no-cache" />
- <link href="../../web/css/bootstrap.min.css" rel="stylesheet" type="text/css">
- <!--<link href="../../web/css/bootstrap-theme.min.css" rel="stylesheet" type="text/css">-->
- <link href="../../web/css/datatables.min.css" rel="stylesheet" type="text/css">
- <link href="../../web/css/dataTables.bootstrap.min.css" rel="stylesheet" type="text/css">
- <link href="../../web/css/bootstrap-datetimepicker.min.css" rel="stylesheet" type="text/css">
- <!-- <link href="../../web/css/bootstrap-timepicker.min.css" rel="stylesheet" type="text/css"> -->
- <link href="../../web/css/bootstrap-multiselect.css" rel="stylesheet" type="text/css">
- <link href="../../web/css/glyphicons.css" rel="stylesheet" type="text/css">
- <link href="../../web/css/summernote.css" rel="stylesheet" type="text/css">
- <link href="../../web/css/creorga.css" rel="stylesheet" type="text/css">
- <style type="text/css">
- .dataTables_filter {
- margin-top: 15px;
- }
- </style>
-</head>
-
-<body>
- <div class="container-fluid" style="padding-top: 5px;">
- <div class="form-inline" >
- <div class="input-group month btn-group">
- <span class="input-group-addon">du mois:</span>
- <input type="date" class="form-control" value="" placeholder="mm.yyyy" style="width: 80px;" id="logmonth">
- <span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
- </div>
- <button class="btn btn-primary" onclick="onpreviousmonth();"><span class="glyphicon glyphicon-chevron-left"></span></button>
- <button class="btn btn-primary" onclick="onnextmonth();"><span class="glyphicon glyphicon-chevron-right"></span></button>
- <button class="btn btn-primary" onclick="newlogmessage();" id="btnaddmessage"><span class="glyphicon glyphicon-plus"></span> Message</button>
- <!--<button class="btn btn-default" id="btneditorhost">Editeur: <span id="editorhost"></span></button>
- <button class="btn btn-danger" id="btnprotection" onclick="confirm_delete_protection();" style="display: none;"><span class="glyphicon glyphicon-remove"></span> protection</button>-->
- </div>
- <div>
- <table style="height: calc(100vh - 100px); width: 100%; ">
- <tbody>
- <tr>
- <td style="width: 550px; vertical-align: top;"><table class="display dataTable cell-border" style="width: 100%;" id="tbl_logcominterne" role="grid"></table></td>
- <td style="vertical-align: top; margin-left: 30px;">
- <div class="form-inline" style="margin-top: 15px; margin-bottom: 10px; margin-left: 10px;">
- <button class="btn btn-success" onclick="edit_cominternelog();" id="btnedit"><span class="glyphicon glyphicon-pencil"></span> éditer</button>
- <button class="btn btn-danger" onclick="confirm_delete_cominterne();" id="btndelete"><span class="glyphicon glyphicon-remove"></span> supprimer</button>
- <button class="btn btn-warning" onclick="confirm_delete_protection();" id="btnprotection"><span class="glyphicon glyphicon-remove"></span> Protection</button>
- </div>
- <input type="hidden" id="cominterneloguuid" value="0">
- <div><strong>Titre:</strong> <span id="cominternelogtitle"></span></div>
- <div><strong>Date: </strong><span id="cominternelogdate"></span></div>
-
- <div style="width: 100%; height: calc(100vh - 200px); background-color: #fff; border: 1px solid grey; border-radius: 10px; display: block; overflow-y: auto; padding: 5px; margin: 5px;" id="cominternelogmessage"></div>
-
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- <div class="modal fade" id="confirm_delete_logcominterne">
- <div class="modal-dialog">
- <div class="modal-content">
- <div class="modal-header">
- <button data-dismiss="modal" class="close" type="button"><span aria-hidden="true">x</span><span class="sr-only">Close</span></button>
-
- <h4 class="modal-title">Supprimer Message</h4>
- </div><!-- dialog contents -->
-
- <div class="modal-body">
- Êtes vous sûre de supprimer ce message?<br>
-
- </div><!-- dialog buttons -->
-
- <div class="modal-footer">
- <button aria-hidden="true" data-dismiss="modal" class="btn">Non</button> <button onclick="delete_logcominterne();" class="btn btn-primary">Oui</button>
- </div>
- </div>
- </div>
- </div>
- <div class="modal fade" id="confirm_delete_protection">
- <div class="modal-dialog">
- <div class="modal-content">
- <div class="modal-header">
- <button data-dismiss="modal" class="close" type="button"><span aria-hidden="true">x</span><span class="sr-only">Close</span></button>
-
- <h4 class="modal-title">Supprimer Protection</h4>
- </div><!-- dialog contents -->
-
- <div class="modal-body">
- Êtes vous sûre de supprimer cette protection?<br>
- (possibilité de perdre des données pas sauvegardées)
- </div><!-- dialog buttons -->
-
- <div class="modal-footer">
- <button aria-hidden="true" data-dismiss="modal" class="btn">Non</button> <button onclick="delete_protection();" class="btn btn-primary">Oui</button>
- </div>
- </div>
- </div>
- </div>
- <div class="modal fade" id="edit_cominternelog">
- <div class="modal-dialog" style="width: 1000px; min-width: 1000px;">
- <div class="modal-content" >
- <div class="modal-header">
- <button data-dismiss="modal" class="close" type="button"><span aria-hidden="true">x</span><span class="sr-only">Close</span></button>
- <h4 class="modal-title">Editer communication</h4>
- </div>
- <div class="modal-body" style=" height: 80vh; max-height: height: 80vh; ">
-
- <div id="frmeditcominterne">
- <input type="hidden" id="loguuid" value="0">
- <div class="row form-inline" style="margin-left: 30px;">
- <label for="logtitle">Titre</label> <input type="text" value="" style="width: 80%;" id="logtitle" class="form-control">
- </div>
- <div class="row" style="margin-left: 30px;">
- <div class="form-inline" id="date-container">
- <label for="logtimestamp" style="width: 100px;">Date</label>
- <div id="dt_logdate" class="input-group date">
- <input type="date" class="form-control" value="" limits="0" placeholder="dd.mm.yyyy" id="logdate"><span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
- </div>
-
-
- </div>
-
- </div>
- <textarea class="summernote" style="width: 100%;" id="logmessage">
-</textarea>
-
- </div>
- </div>
- <div class="modal-footer">
- <button aria-hidden="true" data-dismiss="modal" onclick="removeeditorhost();" class="btn">Annuler</button> <button onclick="save_cominternelog();" class="btn btn-primary">OK</button>
- </div>
- </div>
-
-
- </div>
- </div>
- </div>
-
-
- <script src="../../web/js/jquery.min.js" type="text/javascript"></script>
- <script src="../../web/js/bootstrap.min.js" type="text/javascript"></script>
- <script src="../../web/js/datatables.min.js" type="text/javascript"></script>
- <script src="../../web/js/moment-with-locales.js" type="text/javascript"></script>
- <script src="../../web/js/bootstrap-datetimepicker.min.js" type="text/javascript"></script>
- <!-- <script src="../../web/js/bootstrap-timepicker.min.js" type="text/javascript"></script> -->
- <script src="../../web/js/bootstrap-multiselect.js" type="text/javascript"></script>
- <script src="../../web/js/summernote.min.js" type="text/javascript"></script>
- <script src="../../web/js/lang/summernote-fr-FR.min.js" type="text/javascript"></script>
- <script src="chrome://creorga/content/js/preferences.js" type="text/javascript"></script>
- <script src="chrome://creorga/content/js/navigation.js" type="text/javascript"></script>
- <script src="chrome://creorga/content/js/database.js" type="text/javascript"></script>
- <script src="chrome://creorga/content/js/system.js" type="text/javascript"></script>
- <script src="../../web/js/labels.js" type="text/javascript"></script>
- <script src="js/logcominterne.js" type="text/javascript"></script>
- <script src="../../web/js/creorga.js" type="text/javascript"></script>
-
-</body>
-</html>
+++ /dev/null
-<!DOCTYPE html>
-
-<html lang="fr">
-<head>
- <meta charset="utf-8">
- <title>Communication interne</title>
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <meta http-equiv="cache-control" content="max-age=0" />
- <meta http-equiv="cache-control" content="no-cache" />
- <meta http-equiv="expires" content="0" />
- <meta http-equiv="expires" content="Tue, 01 Jan 1970 1:00:00 GMT" />
- <meta http-equiv="pragma" content="no-cache" />
- <link href="../../web/css/bootstrap.min.css" rel="stylesheet" type="text/css">
- <!--<link href="../../web/css/bootstrap-theme.min.css" rel="stylesheet" type="text/css">-->
- <link href="../../web/css/datatables.min.css" rel="stylesheet" type="text/css">
- <link href="../../web/css/dataTables.bootstrap.min.css" rel="stylesheet" type="text/css">
- <link href="../../web/css/bootstrap-datetimepicker.min.css" rel="stylesheet" type="text/css">
- <!-- <link href="../../web/css/bootstrap-timepicker.min.css" rel="stylesheet" type="text/css"> -->
- <link href="../../web/css/bootstrap-multiselect.css" rel="stylesheet" type="text/css">
- <link href="../../web/css/glyphicons.css" rel="stylesheet" type="text/css">
- <link href="../../web/css/summernote.css" rel="stylesheet" type="text/css">
- <link href="../../web/css/creorga.css" rel="stylesheet" type="text/css">
- <style type="text/css">
- .dataTables_filter {
- margin-top: 15px;
- }
- </style>
-</head>
-
-<body>
- <div class="container-fluid" style="padding-top: 5px;">
- <div class="form-inline" >
- <div class="input-group month btn-group">
- <span class="input-group-addon">du mois:</span>
- <input type="date" class="form-control" value="" placeholder="mm.yyyy" style="width: 80px;" id="logmonth">
- <span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
- </div>
- <button class="btn btn-primary" onclick="onpreviousmonth();"><span class="glyphicon glyphicon-chevron-left"></span></button>
- <button class="btn btn-primary" onclick="onnextmonth();"><span class="glyphicon glyphicon-chevron-right"></span></button>
- <button class="btn btn-primary" onclick="newlogmessage();" id="btnaddmessage"><span class="glyphicon glyphicon-plus"></span> Message</button>
- <!--<button class="btn btn-default" id="btneditorhost">Editeur: <span id="editorhost"></span></button>
- <button class="btn btn-danger" id="btnprotection" onclick="confirm_delete_protection();" style="display: none;"><span class="glyphicon glyphicon-remove"></span> protection</button>-->
- </div>
- <div>
- <table style="height: calc(100vh - 100px); width: 100%; ">
- <tbody>
- <tr>
- <td style="width: 550px; vertical-align: top;"><table class="display dataTable cell-border" style="width: 100%;" id="tbl_logcominterne" role="grid"></table></td>
- <td style="vertical-align: top; margin-left: 30px;">
- <div class="form-inline" style="margin-top: 15px; margin-bottom: 10px; margin-left: 10px;">
- <button class="btn btn-success" onclick="edit_cominternelog();" id="btnedit"><span class="glyphicon glyphicon-pencil"></span> éditer</button>
- </div>
- <input type="hidden" id="cominterneloguuid" value="0">
- <div><strong>Titre:</strong> <span id="cominternelogtitle"></span></div>
- <div><strong>Date: </strong><span id="cominternelogdate"></span></div>
-
- <div style="width: 100%; height: calc(100vh - 200px); background-color: #fff; border: 1px solid grey; border-radius: 10px; display: block; overflow-y: auto; padding: 5px; margin: 5px;" id="cominternelogmessage"></div>
-
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- <div class="modal fade" id="confirm_delete_logcominterne">
- <div class="modal-dialog">
- <div class="modal-content">
- <div class="modal-header">
- <button data-dismiss="modal" class="close" type="button"><span aria-hidden="true">x</span><span class="sr-only">Close</span></button>
-
- <h4 class="modal-title">Supprimer Message</h4>
- </div><!-- dialog contents -->
-
- <div class="modal-body">
- Êtes vous sûre de supprimer ce message?<br>
-
- </div><!-- dialog buttons -->
-
- <div class="modal-footer">
- <button aria-hidden="true" data-dismiss="modal" class="btn">Non</button> <button onclick="delete_logcominterne();" class="btn btn-primary">Oui</button>
- </div>
- </div>
- </div>
- </div>
- <div class="modal fade" id="confirm_delete_protection">
- <div class="modal-dialog">
- <div class="modal-content">
- <div class="modal-header">
- <button data-dismiss="modal" class="close" type="button"><span aria-hidden="true">x</span><span class="sr-only">Close</span></button>
-
- <h4 class="modal-title">Supprimer Protection</h4>
- </div><!-- dialog contents -->
-
- <div class="modal-body">
- Êtes vous sûre de supprimer cette protection?<br>
- (possibilité de perdre des données pas sauvegardées)
- </div><!-- dialog buttons -->
-
- <div class="modal-footer">
- <button aria-hidden="true" data-dismiss="modal" class="btn">Non</button> <button onclick="delete_protection();" class="btn btn-primary">Oui</button>
- </div>
- </div>
- </div>
- </div>
- <div class="modal fade" id="edit_cominternelog">
- <div class="modal-dialog" style="width: 1000px; min-width: 1000px;">
- <div class="modal-content" >
- <div class="modal-header">
- <button data-dismiss="modal" class="close" type="button"><span aria-hidden="true">x</span><span class="sr-only">Close</span></button>
- <h4 class="modal-title">Editer communication</h4>
- </div>
- <div class="modal-body" style=" height: 80vh; max-height: height: 80vh; ">
-
- <div id="frmeditcominterne">
- <input type="hidden" id="loguuid" value="0">
- <div class="row form-inline" style="margin-left: 30px;">
- <label for="logtitle">Titre</label> <input type="text" value="" style="width: 80%;" id="logtitle" class="form-control">
- </div>
- <div class="row" style="margin-left: 30px;">
- <div class="form-inline" id="date-container">
- <label for="logtimestamp" style="width: 100px;">Date</label>
- <div id="dt_logdate" class="input-group date">
- <input type="date" class="form-control" value="" limits="0" placeholder="dd.mm.yyyy" id="logdate"><span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
- </div>
-
-
- </div>
-
- </div>
- <textarea class="summernote" style="width: 100%;" id="logmessage">
-</textarea>
-
- </div>
- </div>
- <div class="modal-footer">
- <button aria-hidden="true" data-dismiss="modal" onclick="removeeditorhost();" class="btn">Annuler</button> <button onclick="save_cominternelog();" class="btn btn-primary">OK</button>
- </div>
- </div>
-
-
- </div>
- </div>
- </div>
-
-
- <script src="../../web/js/jquery.min.js" type="text/javascript"></script>
- <script src="../../web/js/bootstrap.min.js" type="text/javascript"></script>
- <script src="../../web/js/datatables.min.js" type="text/javascript"></script>
- <script src="../../web/js/moment-with-locales.js" type="text/javascript"></script>
- <script src="../../web/js/bootstrap-datetimepicker.min.js" type="text/javascript"></script>
- <!-- <script src="../../web/js/bootstrap-timepicker.min.js" type="text/javascript"></script> -->
- <script src="../../web/js/bootstrap-multiselect.js" type="text/javascript"></script>
- <script src="../../web/js/summernote.min.js" type="text/javascript"></script>
- <script src="../../web/js/lang/summernote-fr-FR.min.js" type="text/javascript"></script>
- <script src="chrome://creorga/content/js/preferences.js" type="text/javascript"></script>
- <script src="chrome://creorga/content/js/navigation.js" type="text/javascript"></script>
- <script src="chrome://creorga/content/js/database.js" type="text/javascript"></script>
- <script src="chrome://creorga/content/js/system.js" type="text/javascript"></script>
- <script src="../../web/js/labels.js" type="text/javascript"></script>
- <script src="js/logcominterne.js" type="text/javascript"></script>
- <script src="../../web/js/creorga.js" type="text/javascript"></script>
-
-</body>
-</html>
+++ /dev/null
-body {
- font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
- font-size: 11px;
- line-height: 1.42857;
- background-color: #fff;
-}
-h2 {
- font-size: 18px;
- font-weight: bold;
- margin-top: 0px;
- margin-bottom: 5px;
-}
-
-h3 {
- font-size: 14px;
- font-style: italic;
- margin-top: 0px;
- margin-bottom: 5px;
-}
-
-.dataTables_filter {
- height: 0px;
- width: 0px;
-}
-
-/*.dataTable > thead > tr > th {*/
-/* padding-top: 70px;*/
-/*}*/
-
-/*.dataTable > tfoot > tr > th {
- padding-bottom: 40px;
-}*/
-
-/*tfoot { display: table-footer-group;*/
-/* position: absolute; */
-/* bottom: 0; }*/
-
-.alignright{
- text-align: right;
-}
-
-.alignleft {
- text-align: left;
-}
-
-.noprint {
- display: none;
-}
-
-
-
-@media print {
-
-@page {
- margin-left: 2cm;
- margin-right: 1cm;
- margin-top: 1cm;
- margin-bottom: 1cm;
-}
-
-tfoot {
- display: table-row-group;
-}
-
-table {
- width: 100% !Important;
- border-spacing: 0;
- border-collapse: collapse;
-}
-
-table.dataTable td {
- white-space: nowrap;
- overflow: hidden;
-}
-
-table.dataTable > thead > th > td {
- white-space: nowrap;
- overflow: hidden;
-}
-table.dataTable tr {
- page-break-inside: avoid;
- page-break-after: auto;
- }
-
-table.dataTable tfoot {
- page-break-inside: avoid;
- page-break-after: auto;
- }
-
-table.dataTable tfoot > th > td {
- font-size: 2vw;
-}
-table.dataTable {
- width: 100% !Important;
- border-spacing: 0;
- border-collapse: collapse;
-}
-
-#print-head {
- display: block;
- position: fixed;
- font-family: Arial,Helvetica, sans-serif;
- z-index: 10;
- top: 0pt;
- left:0pt;
- right: 0pt;
- background-color: #fff;
- text-align: center;
- }
-
-/*#print-foot {
- display: block;
- position: fixed;
- width: 100%;
- padding-top: 5px;
- bottom: 0pt;
- text-align: center;
- right: auto;
- left: auto;
- font-family: Arial,Helvetica, sans-serif;
- }*/
-
-/*#print-foot:after {
- content: counter(page);
- counter-increment: page;
- }*/
-
-
-.dataTables_filter {
- height: 0px;
- width: 0px;
-}
-
-.dataTable {
- width: 100% !Important;
-}
-
-}
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0"?>
-<!DOCTYPE dialog PUBLIC "-//MOZILLA//DTD XUL V1.0//EN" "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
-
-<?xml-stylesheet href="chrome://global/skin/global.css" type="text/css"?>
-
-<dialog id="dlgprdfviewer" title="PDF Viewer"
- xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
- persist="screenX screenY width height"
- buttons="accept"
- buttonlabelaccept="Fermer"
- ondialogaccept="return OK();"
- >
- <script type="application/javascript" src="chrome://creorga/content/js/system.js" />
- <vbox flex="1">
- <browser id="pdfviewer" flex="1" src="chrome://creorga/web/pdfjs/web/viewer.html" type="content-primary" style="background-color: #fff;"/>
- </vbox>
-<script><![CDATA[
-
-
- function OK() {
- window.close();
- }
-
-
- if (window.arguments[0]. in != null) {
- var appd = OS.Path.split(system.appdir());
- var len = appd.components.length-1;
- var npath = new Array();
- for (var i=0; i<len;i++){
- npath.push("..");
- }
- var abspath= window.arguments[0].in.uri.substring(8);
- //dump("PDF URI: "+ abspath + "\n");
- //npath.join("/") +
- //?file=" +abspath file:///
-
- document.getElementById("pdfviewer").loadURI("chrome://creorga/content/web/pdfjs/web/viewer.html?file=" +abspath, null, 'UTF-8');
-
- }
-]]>
-</script>
-</dialog>
+++ /dev/null
-<?xml version="1.0"?>
-<!DOCTYPE dialog PUBLIC "-//MOZILLA//DTD XUL V1.0//EN" "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
-
-<?xml-stylesheet href="chrome://global/skin/global.css" type="text/css"?>
-
-<dialog id="dlgprint" title="Impression"
- xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
- persist="screenX screenY width height"
- buttons="accept"
- buttonlabelaccept="Fermer"
- ondialogaccept="return OK();"
- minwidth="1020"
- minheight="600"
- >
- <script type="application/javascript" src="chrome://global/content/printUtils.js"/>
- <script type="application/javascript" src="chrome://creorga/content/js/system.js" />
- <vbox flex="1">
- <toolbox id="previewtoolbox">
-<toolbar>
-<toolbarbutton label="Configuration" id="cmd_pageSetup" image="../img/settings.png" orient="vertical" oncommand="showpagesetup();"/>
-<toolbarbutton label="Imprimer" id="cmd_print" image="../img/print.png" orient="vertical" oncommand="PrintUtils.print(document.getElementById('print_browser').contentWindowAsCPOW, document.getElementById('print_browser'));" />
-</toolbar>
-</toolbox>
- <browser id="print_browser" src="about:blank" type="content-primary" style="height: 0px;" autoscroll="true"/>
- <browser id="preview_browser" src="about:blank" type="content-primary" flex="1" autoscroll="true" />
- </vbox>
-<script><![CDATA[
- var PSSVC = Components.classes["@mozilla.org/gfx/printsettings-service;1"].getService(Components.interfaces.nsIPrintSettingsService);
- var printSettings = PSSVC.newPrintSettings; printSettings.printerName = PSSVC.printerName;
- if (system.os == "WINNT") {
- //code
-
- if (!printSettings.printerName) {
- printSettings.printerName = PSSVC.defaultPrinterName;
- }
- PSSVC.initPrintSettingsFromPrinter(printSettings.printerName, printSettings);
- PSSVC.initPrintSettingsFromPrefs(printSettings, true, printSettings.kInitSaveAll);
- }
- if (system.os == "WINNT") {
- var printPreviewTB = {
- inititalize: function() {
- },
- updateToolbar: function() {
- }
- };
-
- var PrintPreviewListener = {
- getPrintPreviewBrowser: function() {
- return document.getElementById('preview_browser');
- },
- getSourceBrowser: function() {
- return document.getElementById('print_browser');
- },
- getNavToolbox: function() {
- return document.getElementById('previewtoolbox');
- },
- onEnter: function() {
- //gInPrintPreviewMode = true;
- this._toggleAffectedChrome();
-
- },
- onExit: function() {
- this._toggleAffectedChrome();
- this._printPreviewTab = null;
- }
- }
- }
-
-
- function OK() {
- window.close();
- }
-
- function reload() {
- //var orientval = ((printSettings.orientation == 1) ? "landscape" : "portrait");
- window.arguments[0].out = {
- reload: true
- };
- window.close();
- }
-
- function savedocument() {
- var sdoc = document.getElementById("print_browser").contentDocument;
- var webBrowserPersist = Components.classes["@mozilla.org/embedding/browser/nsWebBrowserPersist;1"]
- .createInstance(Components.interfaces.nsIWebBrowserPersist);
- var localFile = Components.classes["@mozilla.org/file/local;1"]
- .createInstance(Components.interfaces.nsILocalFile);
- localFile.initWithPath(system.tmpdir() + system.sep() + 'test' + system.sep() + 'test.html');
- //"File saved to: " + system.tmpdir() + system.sep() + 'test' + system.sep() + 'test.html' + "\n");
- var localDir = Components.classes["@mozilla.org/file/local;1"]
- .createInstance(Components.interfaces.nsILocalFile);
- localDir.initWithPath(system.tmpdir() + system.sep() + 'test' + system.sep() + 'testdata');
-
- webBrowserPersist.saveDocument(sdoc, localFile, localDir, null, null, null);
- }
-
- function showpagesetup() {
- try {
- var x = PrintUtils.showPageSetup();
- } catch (e) {} finally {
- reload();
- }
- }
-
- function resize() {
- var ww = 1020;
- if (printSettings.orientation == 1) {
- ww = 1430;
- }
- if (ww > window.screen.width) {
- ww = window.screen.width;
- }
- window.resizeTo(ww, window.screen.availHeight);
- }
- if (window.arguments[0].in != null) {
- document.getElementById("print_browser").loadURI(window.arguments[0].in.uri, null, 'UTF-8');
- printSettings.printBGColors = true;
- printSettings.printBGImages = true;
- printSettings.unwriteableMarginTop = 0.5;
- printSettings.unwriteableMarginLeft = 0.5;
- printSettings.unwriteableMarginBottom = 0.5;
- printSettings.unwriteableMarginRight = 0.5;
- printSettings.marginTop = 0.2; /* these are in inches */
- printSettings.marginLeft = 0.2;
- printSettings.marginBottom = 0.2;
- printSettings.marginRight = 0.2;
- //printSettings.shrinkToFit;
- printSettings.paperName = "iso_a4"; /* name of paper */
- printSettings.paperSizeType = 1; /* use native data or is defined here */
- //printSettings.paperData = 9; /* native data value */
- if (printSettings.orientation == 1) {
- printSettings.paperWidth = 297.0; /* width of the paper in inches or mm */
- printSettings.paperHeight = 210.0; /* height of the paper in inches or mm */
-
- } else {
- printSettings.paperWidth = 210.0; /* width of the paper in inches or mm */
- printSettings.paperHeight = 297.0; /* height of the paper in inches or mm */
- }
- printSettings.paperSizeUnit = 1; /* paper is in inches or mm */
- //lets hide those ugly default headers
- printSettings.footerStrCenter = '';
- printSettings.footerStrLeft = '';
- printSettings.footerStrRight = '';
- printSettings.headerStrCenter = '';
- printSettings.headerStrLeft = '';
- printSettings.headerStrRight = '';
-
- PSSVC.savePrintSettingsToPrefs(printSettings, true, printSettings.kInitSaveAll);
- gBrowser = document.getElementById("preview_browser");
- gBrowser.selectedBrowser = document.getElementById("preview_browser");
- if (system.os == "WINNT") {
- PSSVC.savePrintSettingsToPrefs(printSettings, true, printSettings.kInitSavePrinterName);
- PrintUtils.printPreview(PrintPreviewListener);
- resize();
- } else {
- document.getElementById("preview_browser").setAttribute("hidden", true);
- document.getElementById("print_browser").removeAttribute("style");
- document.getElementById("print_browser").setAttribute("flex", "1");
- //document.getElementById("cmd_save").setAttribute("hidden", true);
- }
- }
- ]]>
-</script>
-</dialog>
+++ /dev/null
-//Source-code licensed under EUPL v1.1 ( Copyright 2016 By DKS s.à r.l. - Kilian Saffran - Luxembourg )
-document.onreadystatechange = function () {
- if (document.readyState == "complete") {
- try {
- initdata();
- }catch(e){
- //dump("Print.js No initdata function!\n");
- }
- }
-}
-
-function encodeparam(string,type){
- if (type == "text") {
- if (string == "") {
- string = 'null';
- }else {
- string = string.replace('<','<','g');
- string = string.replace('>','>','g');
- string = string.replace('&','&','g');
- string = string.replace('"','"','g');
- string = string.replace("'","''",'g');
- string = "'"+ string+"'";
- }
- }else if(type == "date"){
- var re = /^(\d{1,2})\.(\d{1,2})\.(\d{4})$/i;
- if (!string.match(re)) {
- string = 'null';
- }else{
- var dspl=string.split('.');
- string = "'"+dspl[2]+'-'+dspl[1]+'-'+dspl[0]+"'";
- }
- }else if(type == "number"){
- if (string == "") {
- string = 'null';
- }else {
- string.replace(',','.');
- string = parseFloat(string);
- }
- }else if(type == "boolean"){
- if (string == "") {
- string = 'null';
- }
- string= string.replace('true',"'1'");
- string= string.replace('false',"'0'");
- }else if(type == "month"){
- var re = /^(\d{1,2})\.(\d{4})$/i;
- if (!string.match(re)) {
- string = 'null';
- }else{
- var dspl=string.split('.');
- string = "'"+dspl[1]+'-'+dspl[0]+"-01'"
- }
- }
- else {
- string = string.replace('<','<','g');
- string = string.replace('>','>','g');
- string = string.replace('&','&','g');
- string = string.replace('"','"','g');
- string = string.replace("'","''",'g');
- string = "'"+ string+"'";
- }
-
- return string;
-}
\ No newline at end of file
+++ /dev/null
-//Source-code licensed under EUPL v1.1 ( Copyright 2016 By DKS s.à r.l. - Kilian Saffran - Luxembourg )
-var pconfig = {};
-
-function initdata(){
- var configdata = apppref.getpreference("pageconfig.logactivity");
- if (configdata != '') {
- pconfig = JSON.parse(configdata);
- }
- //"Book Ident Data:" + JSON.stringify(pconfig) + "\n");
- var windowMediator = Components.classes["@mozilla.org/appshell/window-mediator;1"]
- .getService(Components.interfaces.nsIWindowMediator);
- var winmain = windowMediator.getMostRecentWindow("xulcreorga");
- var maindoc = winmain.document.getElementById("brw_application").contentDocument;
-
- //var xdate = new Date();
- //$("#printdatetime").html(xdate.toLocaleFormat("%d.%m.%Y %H:%M:%S"));
-
- $("#title_sub").html(winmain.document.getElementById("infoheader").value);
-
- $("#title_main").html(maindoc.title);
- //$("#tbl_list").css("margin-top","100px");
- var crn = appdb.dbquery("select crechename,adress,city,country,zip from creche;");
- crn = crn.sqldata[0];
- $("#creche_name").html(crn.crechename);
- $("#creche_address").html(crn.adress);
- $("#creche_zip").html(crn.zip);
- $("#creche_city").html(crn.city);
- loadactivitydata();
-}
-
-function loadactivitydata(){
- var actdatasql = "SELECT strftime('%d.%m.%Y',logdatefrom) || ' - ' || strftime('%d.%m.%Y',logdateto) as daterange, logtitle, logmessage FROM activitylog where uuid='"+ pconfig.activityuuid+"';";
- //dump(actdatasql + "\n");
- var data = appdb.dbquery(actdatasql);
- $("#bookdata").append('<h2>'+ data.sqldata[0].logtitle+'</h2>');
- $("#bookdata").append('<h4>'+ data.sqldata[0].daterange+'</h4>');
- $("#bookdata").append('<div>'+ data.sqldata[0].logmessage+'</div>');
-}
-
-
-
+++ /dev/null
-//Source-code licensed under EUPL v1.1 ( Copyright 2016 By DKS s.à r.l. - Kilian Saffran - Luxembourg )
-function initdata(){
- var windowMediator = Components.classes["@mozilla.org/appshell/window-mediator;1"]
- .getService(Components.interfaces.nsIWindowMediator);
- var winmain = windowMediator.getMostRecentWindow("xulcreorga");
-
- var maindoc = winmain.document.getElementById("brw_application").contentDocument;
-
- var xdate = new Date();
- $("#printdatetime").html(xdate.toLocaleFormat("%d.%m.%Y %H:%M:%S"));
- $("#title_sub").html(winmain.document.getElementById("infoheader").value);
- $("#title_main").html(maindoc.title);
- //$("#cal_month").css("margin-top","100px");
- var crn = appdb.dbquery("select crechename,adress,city,country,zip from creche;");
- crn = crn.sqldata[0];
- $("#creche_name").html(crn.crechename);
- $("#creche_address").html(crn.adress);
- $("#creche_zip").html(crn.zip);
- $("#creche_city").html(crn.city);
-
- var elx = maindoc.querySelectorAll('table[id^="cal_"]');
-
- for (var i in elx) {
- //dump(elx[i].id + "\n");
- if (elx[i].id) {
- var elementdata = maindoc.getElementById(elx[i].id).innerHTML;
-
- //elementdata = elementdata.replace(/height:\ 0px;/g,'');
- //elementdata = elementdata.replace(/height:0;/g,'');
- $("#cal_month").append(elementdata);
- //$("#tbl_list th:first-child").remove();
- //$("#tbl_list td:first-child").remove();
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-//Source-code licensed under EUPL v1.1 ( Copyright 2016 By DKS s.à r.l. - Kilian Saffran - Luxembourg )
-var pconfig = {};
-function initdata(){
- var configdata = apppref.getpreference("pageconfig.child");
- if (configdata != '') {
- pconfig = JSON.parse(configdata);
- }
- var windowMediator = Components.classes["@mozilla.org/appshell/window-mediator;1"]
- .getService(Components.interfaces.nsIWindowMediator);
- var winmain = windowMediator.getMostRecentWindow("xulcreorga");
- var maindoc = winmain.document.getElementById("brw_application").contentDocument;
-
- //var xdate = new Date();
- //$("#printdatetime").html(xdate.toLocaleFormat("%d.%m.%Y %H:%M:%S"));
-
- $("#title_sub").html(winmain.document.getElementById("infoheader").value);
-
- $("#title_main").html(maindoc.title);
- //$("#tbl_list").css("margin-top","100px");
- var crn = appdb.dbquery("select crechename,adress,city,country,zip from creche;");
- crn = crn.sqldata[0];
- $("#creche_name").html(crn.crechename);
- $("#creche_address").html(crn.adress);
- $("#creche_zip").html(crn.zip);
- $("#creche_city").html(crn.city);
-
- var cdatasql = "select child.uuid,child.clientnumber,child.prename,child.surname,strftime('%d.%m.%Y',child.birthday) as birthday,child.address,child.city,child.zip,child.country,strftime('%d.%m.%Y',child.entrydate) as entrydate,child.checkservicenumber,strftime('%d.%m.%Y',child.checkserviceexpiration) as checkserviceexpiration,strftime('%d.%m.%Y',child.leavedate) as leavedate,child.nationality,child.nativelanguage,child.bankaccount,child.bankbic,child.cautionamount,child.cautionpayed,child.cautionremark,child.cautionpayedback,child.cautionstatusdate,child.remark,child.uuid,health.docname, health.docphone,health.docaddress,health.doczip, health.doccity,health.doccountry,health.healthinfo,health.uuid as docuuid from childs child join health health on (child.uuid=health.childuuid) where child.uuid='" + pconfig.uuid + "';";
- var cdata = appdb.dbquery(cdatasql);
- $('#financedata').hide();
- if (cdata) {
- cdata = cdata.sqldata[0];
- var hx = true;
- for (var ci in cdata) {
- if (document.getElementById("childs_" + ci)) {
- $("#childs_" + ci).html(cdata[ci]);
- }
- if (document.getElementById("health_" + ci)) {
- if (cdata[ci] != '') {
- hx = false;
- $("#health_" + ci).html(cdata[ci]);
- }else {
- $("#health_" + ci).hide();
- }
-
- }
-
- }
- if (hx) {
- $('#healthdata').hide();
- }
- }
-
- load_table_presence();
- load_table_parents();
- load_table_refpersons();
- var cdatea = new Date();
- //$("#printdatetime").html(cdatea.toLocaleFormat("%d.%m.%Y %H:%M:%S"));
- //$("#accmonth").html(myfilter.description);
- var crn = appdb.dbquery("select crechename,adress,city,country,zip from creche;");
- crn = crn.sqldata[0];
- $("#creche_name").html(crn.crechename);
- $("#creche_address").html(crn.adress);
- $("#creche_zip").html(crn.zip);
- $("#creche_city").html(crn.city);
-}
-
-function load_table_presence(){
- var plandatasql = "SELECT grp.grpname, strftime('%d.%m.%Y',plan.datebegin) || ' - ' || strftime('%d.%m.%Y',plan.dateend) AS planningdaterange, plan.montimebegin || ' - ' || plan.montimeend || CASE WHEN plan.monlunch='1' THEN ' (<span class=\"glyphicon glyphicon-cutlery\" aria-hidden=\"true\"></span>)' ELSE '' END || case when plan.montimebegin2 is not null and plan.montimeend2 is not null then '<br/>' || plan.montimebegin2 || ' - ' || plan.montimeend2 else '' end AS monplanningtime, plan.tuetimebegin || ' - ' || plan.tuetimeend || CASE WHEN plan.tuelunch='1' THEN ' (<span class=\"glyphicon glyphicon-cutlery\" aria-hidden=\"true\"></span>)' ELSE '' END || case when plan.tuetimebegin2 is not null and plan.tuetimeend2 is not null then '<br/>' || plan.tuetimebegin2 || ' - ' || plan.tuetimeend2 else '' end AS tueplanningtime, plan.wedtimebegin || ' - ' || plan.wedtimeend || CASE WHEN plan.wedlunch='1' THEN ' (<span class=\"glyphicon glyphicon-cutlery\" aria-hidden=\"true\"></span>)' ELSE '' END || case when plan.wedtimebegin2 is not null and plan.wedtimeend2 is not null then '<br/>' || plan.wedtimebegin2 || ' - ' || plan.wedtimeend2 else '' end AS wedplanningtime, plan.thutimebegin || ' - ' || plan.thutimeend || CASE WHEN plan.thulunch='1' THEN ' (<span class=\"glyphicon glyphicon-cutlery\" aria-hidden=\"true\"></span>)' ELSE '' END || case when plan.thutimebegin2 is not null and plan.thutimeend2 is not null then '<br/>' || plan.thutimebegin2 || ' - ' || plan.thutimeend2 else '' end AS thuplanningtime, plan.fritimebegin || ' - ' || plan.fritimeend || CASE WHEN plan.frilunch='1' THEN ' (<span class=\"glyphicon glyphicon-cutlery\" aria-hidden=\"true\"></span>)' ELSE '' END || case when plan.fritimebegin2 is not null and plan.fritimeend2 is not null then '<br/>' || plan.fritimebegin2 || ' - ' || plan.fritimeend2 else '' end AS friplanningtime FROM planning plan LEFT JOIN groups grp ON ( plan.groupuuid=grp.uuid) WHERE plan.childuuid='" + pconfig.uuid + "' ORDER BY plan.datebegin, plan.dateend;";
- var plandata = appdb.dbqueryarray(plandatasql);
- if (plandata) {
- var headerdata = getlabels(plandata.sqlhead.join(","));
- $("#tbl_planning").html("");
- var tblplan = $("#tbl_planning").dataTable({
- "language": {
- "url": "L../../web/js/locale/datatable_fr.json"
- },
- "data": plandata.sqldata,
- "columns": headerdata,
- "paging": false,
- "ordering": false,
- "info": false,
- "filter": false,
- "destroy": true
- });
- }else {
- $('#planningdata').hide();
- }
-}
-
-function load_table_parents() {
- var labelx = getlabelswithkey('mother,father');
- var areftypes = new Array();
- for (var l in labelx){
- areftypes.push("select '"+ labelx[l].title +"' as refname, '"+labelx[l].keyname+"' as reftype");
- }
- var lblsql = areftypes.join(" UNION ");
- var parentssql = "SELECT rx.refname as reftype, coalesce(rp.surname,'') || ' ' || coalesce(rp.prename,'') as nameprename, coalesce(rp.address,'') || '<br/>' || coalesce(rp.zip,'') || ' ' || coalesce(rp.city,'') || '<br/>' || coalesce(rp.country,'') as address, case when rp.phone is not null then '<span class=\"glyphicon glyphicon-earphone\" aria-hidden=\"true\"></span>: ' || rp.phone || '<br/>' else '' end || case when rp.mobile is not null then'<span class=\"glyphicon glyphicon-phone\" aria-hidden=\"true\"></span>: ' || rp.mobile || '<br/>' else '' end || case when rp.workphone is not null then '<span class=\"glyphicon glyphicon-phone-alt\" aria-hidden=\"true\"></span>: ' || rp.workphone || '<br/>' else '' end || case when rp.email is not null then '<span class=\"glyphicon glyphicon-envelope\" aria-hidden=\"true\"></span>: ' || email else '' end as phonemail, rp.job, rp.authsubscriber FROM refpersons rp join ("+lblsql+") rx on (rp.reftype=rx.reftype) where rp.childuuid='" + pconfig.uuid + "' and rp.reftype in ('mother','father');";
-
- var parentsdata = appdb.dbqueryarray(parentssql);
- if (parentsdata) {
- var headerdata = getlabels(parentsdata.sqlhead.join(","));
- $("#tbl_parents").html("");
- $("#tbl_parents").dataTable({
-"language": {
- "url": "../../web/js/locale/datatable_fr.json"
- },
- "data": parentsdata.sqldata,
- "columns": headerdata,
- "paging": false,
- "ordering": false,
- "info": false,
- "filter": false,
- "destroy": true
- });
- }else {
- $('#parentdata').hide();
- }
-
-
-
-}
-
-function load_table_refpersons() {
- var labelx = getlabelswithkey('tuteur,famillymember,famillyfriend');
- var areftypes = new Array();
- for (var l in labelx){
- areftypes.push("select '"+ labelx[l].title +"' as refname, '"+labelx[l].keyname+"' as reftype");
- }
- var lblsql = areftypes.join(" UNION ");
- var refpersonsql = "SELECT rx.refname as reftype, coalesce(rp.surname,'') || ' ' || coalesce(rp.prename,'') as nameprename, coalesce(rp.address,'') || '<br/>' || coalesce(rp.zip,'') || ' ' || coalesce(rp.city,'') || '<br/>' || coalesce(rp.country,'') as address, case when rp.phone is not null then '<span class=\"glyphicon glyphicon-earphone\" aria-hidden=\"true\"></span>: ' || rp.phone || '<br/>' else '' end || case when rp.mobile is not null then'<span class=\"glyphicon glyphicon-phone\" aria-hidden=\"true\"></span>: ' || rp.mobile || '<br/>' else '' end || case when rp.workphone is not null then '<span class=\"glyphicon glyphicon-phone-alt\" aria-hidden=\"true\"></span>: ' || rp.workphone || '<br/>' else '' end || case when rp.email is not null then '<span class=\"glyphicon glyphicon-envelope\" aria-hidden=\"true\"></span>: ' || email else '' end as phonemail, rp.job, rp.authsubscriber FROM refpersons rp join ("+lblsql+") rx on (rp.reftype=rx.reftype) where rp.childuuid='" + pconfig.uuid + "' and rp.reftype not in ('mother','father');";
-
- var refpersonsdata = appdb.dbqueryarray(refpersonsql);
- if (refpersonsdata) {
- var headerdata = getlabels(refpersonsdata.sqlhead.join(","));
- $("#tbl_refpersons").html("");
- $("#tbl_refpersons").dataTable({
- "language": {
- "url": "../../web/js/locale/datatable_fr.json"
- },
- "data": refpersonsdata.sqldata,
- "columns": headerdata,
- "paging": false,
- "ordering": false,
- "info": false,
- "filter": false,
- "destroy": true
- });
- }else {
- $('#refpersondata').hide();
- }
-
-
-
-}
-
+++ /dev/null
-//Source-code licensed under EUPL v1.1 ( Copyright 2016 By DKS s.à r.l. - Kilian Saffran - Luxembourg )
-function initdata(){
- var windowMediator = Components.classes["@mozilla.org/appshell/window-mediator;1"]
- .getService(Components.interfaces.nsIWindowMediator);
- var winmain = windowMediator.getMostRecentWindow("xulcreorga");
- var maindoc = winmain.document.getElementById("brw_application").contentDocument;
-
- $("#title_sub").html(winmain.document.getElementById("infoheader").value);
-
- $("#title_main").html(maindoc.title);
- var crn = appdb.dbquery("select crechename,adress,city,country,zip from creche;");
- crn = crn.sqldata[0];
- $("#creche_name").html(crn.crechename);
- $("#creche_address").html(crn.adress);
- $("#creche_zip").html(crn.zip);
- $("#creche_city").html(crn.city);
-
- var elx = maindoc.querySelectorAll('div[id^="tbl"]');
- //var elx = maindoc.querySelectorAll('tfoot');
-
- var tcols = 1;
- var strlp = apppref.getpreference("pageconfig.lastpage");
- var lp = JSON.parse(strlp);
- var strcp = apppref.getpreference("pageconfig." + lp.view);
- var cp = JSON.parse(strcp);
- var ctab = "";
- //"print_loaddata.js \n");
- if (cp.activetab) {
- ctab = cp.activetab;
- }
- for (var i in elx) {
- //dump(elx[i].id)
- if ((elx[i].id ) && (elx[i].id.indexOf(ctab+"_wrapper") != -1)) {
-
- var elementdata = maindoc.getElementById(elx[i].id).innerHTML;
-
- elementdata = elementdata.replace(/height:\ 0px;/g,'');
- elementdata = elementdata.replace(/height:0;/g,'');
- elementdata = elementdata.replace(/colspan="1" rowspan="1"/g,'');
- elementdata = elementdata.replace(/style="width:\s\d+px;"/g,'');
-
- var thead = elementdata.substring(elementdata.indexOf('<thead>'),elementdata.indexOf('</thead>')).replace('<thead>','');
- var tbody = elementdata.substring(elementdata.indexOf('<tbody>'),elementdata.indexOf('</tbody>')).replace('<tbody>','');
- var tfoot = elementdata.substring(elementdata.lastIndexOf('<tfoot>'),elementdata.lastIndexOf('</tfoot>')).replace('<tfoot>','');
-
- tcols = thead.split('</th>');
-
-
-
- $("#tbl_list > thead").append(thead);
- $("#tbl_list > tbody").append(tbody);
- $("#tbl_list > tfoot").append(tfoot);
-
- }
- }
- //$("#tbl_list").removeClass("dataTable");
- // $("#tbl_list").dataTable({
- // "language": {
- // "url": "../../../web/js/locale/datatable_fr.json"
- // },
- // "paging": false,
- // "ordering": false,
- // "info": false,
- // "filter": false,
- // "destroy": true
- //});
-}
\ No newline at end of file
+++ /dev/null
-//Source-code licensed under EUPL v1.1 ( Copyright 2016 By DKS s.à r.l. - Kilian Saffran - Luxembourg )
-var pconfig = {};
-var initdate = new Date();
-
-function initdata(){
-
- var configdata = apppref.getpreference("pageconfig.logchild");
- if (configdata != '') {
- pconfig = JSON.parse(configdata);
- }
- var windowMediator = Components.classes["@mozilla.org/appshell/window-mediator;1"]
- .getService(Components.interfaces.nsIWindowMediator);
- var winmain = windowMediator.getMostRecentWindow("xulcreorga");
- var maindoc = winmain.document.getElementById("brw_application").contentDocument;
- initdate = new Date(encodeparam(pconfig.logdate, 'date').replace(/'/g, ''));
- //var xdate = new Date();
- //$("#printdatetime").html(xdate.toLocaleFormat("%d.%m.%Y %H:%M:%S"));
-
- $("#title_sub").html(pconfig.logdate);
-
- $("#title_main").html(maindoc.title);
- //$("#tbl_list").css("margin-top","100px");
- var crn = appdb.dbquery("select crechename,adress,city,country,zip from creche;");
- crn = crn.sqldata[0];
- $("#creche_name").html(crn.crechename);
- $("#creche_address").html(crn.adress);
- $("#creche_zip").html(crn.zip);
- $("#creche_city").html(crn.city);
-
- load_table_logchilds();
-}
-
-function load_table_logchilds(){
- var logsql = "select ch.prename || ' ' || ch.surname AS childname, ch.checkservicenumber,lc.logmessage from childs ch left join planning pl on (ch.uuid=pl.childuuid) left join childslog lc on (lc.childuuid=ch.uuid) where date('"+ initdate.toLocaleFormat('%Y-%m-%d')+"') between pl.datebegin and pl.dateend and lc.logmessage is not null and lc.logmessage != '' order by childname;";
-
- var logdata = appdb.dbquery(logsql);
-
- for (var i in logdata.sqldata){
- var row = logdata.sqldata[i];
- //"initdata print_logchild! " + JSON.stringify(row)+"\n");
- var divd = '<div class="row panel panel-default"><div class="panel-heading"><strong>'+ row.childname + '</strong> ('+ row.checkservicenumber + ')'+'</div>';
- divd += '<div class="panel-body">'+ row.logmessage+'</div></div>';
- $("#div_data").append(divd);
- }
-}
\ No newline at end of file
+++ /dev/null
-//Source-code licensed under EUPL v1.1 ( Copyright 2016 By DKS s.à r.l. - Kilian Saffran - Luxembourg )
-function initdata(){
- var windowMediator = Components.classes["@mozilla.org/appshell/window-mediator;1"]
- .getService(Components.interfaces.nsIWindowMediator);
- var winmain = windowMediator.getMostRecentWindow("xulcreorga");
- var maindoc = winmain.document.getElementById("brw_application").contentDocument;
-
- $("#title_sub").html(winmain.document.getElementById("infoheader").value);
-
- $("#title_main").html(maindoc.title);
- var crn = appdb.dbquery("select crechename,adress,city,country,zip from creche;");
- crn = crn.sqldata[0];
- $("#creche_name").html(crn.crechename);
- $("#creche_address").html(crn.adress);
- $("#creche_zip").html(crn.zip);
- $("#creche_city").html(crn.city);
-
- var elx = maindoc.querySelectorAll('div[id^="tbl"]');
- //var elx = maindoc.querySelectorAll('tfoot');
- //"print_multilist.js \n");
- var tcols = 1;
- var strlp = apppref.getpreference("pageconfig.lastpage");
- var lp = JSON.parse(strlp);
- var strcp = apppref.getpreference("pageconfig." + lp.view);
- var cp = JSON.parse(strcp);
- var ctab = "";
- //dump(JSON.stringify(cp) + "\n");
- var getpagedesign=$("#allpages").html();
- //dump(getpagedesign + "\n===============\n");
- var cnt = 1;
- $("#allpages").html("");
- for (var i in elx) {
- // //dump(elx[i].id)
- if ((elx[i].id ) && (elx[i].id.indexOf(ctab+"_wrapper") != -1)) {
- var npage = getpagedesign.replace(/_xxnum/g,cnt);
-
- var elementdata = maindoc.getElementById(elx[i].id).innerHTML;
- //
- elementdata = elementdata.replace(/height:\ 0px;/g,'');
- elementdata = elementdata.replace(/height:0;/g,'');
- elementdata = elementdata.replace(/colspan="1" rowspan="1"/g,'');
- elementdata = elementdata.replace(/style="width:\s\d+px;"/g,'');
- //
- var thead = elementdata.substring(elementdata.indexOf('<thead>'),elementdata.indexOf('</thead>')).replace('<thead>','');
- var tbody = elementdata.substring(elementdata.indexOf('<tbody>'),elementdata.indexOf('</tbody>')).replace('<tbody>','');
- var tfoot = elementdata.substring(elementdata.lastIndexOf('<tfoot>'),elementdata.lastIndexOf('</tfoot>')).replace('<tfoot>','');
- //
- //tcols = thead.split('</th>');
- //dump(tbody + "\n========\n");
- //
- //
- if (tbody.indexOf("dataTables_empty") == -1) {
- $("#allpages").append(npage);
- $("#tbl_list"+cnt+" > thead").append(thead);
- $("#tbl_list"+cnt+" > tbody").append(tbody);
- $("#tbl_list"+cnt+" > tfoot").append(tfoot);
-
- $("#tbl_list" + cnt).dataTable({
- "language": {
- "url": "../../../web/js/locale/datatable_fr.json"
- },
- "paging": false,
- "ordering": false,
- "info": false,
- "filter": false,
- "destroy": true
- });
- cnt++;
- }
-
- }
- }
- $('[id$="lunch"]').removeClass('btn-success');
- $('[id$="lunch"]').addClass('btn-default');
-}
\ No newline at end of file
+++ /dev/null
-//Source-code licensed under EUPL v1.1 ( Copyright 2016 By DKS s.à r.l. - Kilian Saffran - Luxembourg )
-function initdata(){
- var windowMediator = Components.classes["@mozilla.org/appshell/window-mediator;1"]
- .getService(Components.interfaces.nsIWindowMediator);
- var winmain = windowMediator.getMostRecentWindow("xulcreorga");
- var maindoc = winmain.document.getElementById("brw_application").contentDocument;
-
- $("#title_sub").html(winmain.document.getElementById("infoheader").value);
-
- $("#title_main").html(maindoc.title);
- var crn = appdb.dbquery("select crechename,adress,city,country,zip from creche;");
- crn = crn.sqldata[0];
- $("#creche_name").html(crn.crechename);
- $("#creche_address").html(crn.adress);
- $("#creche_zip").html(crn.zip);
- $("#creche_city").html(crn.city);
-
- var elx = maindoc.querySelectorAll('table[id="tbl_timetable"]');
- //var elx = maindoc.querySelectorAll('tfoot');
-
- var tcols = 1;
- var strlp = apppref.getpreference("pageconfig.lastpage");
- var lp = JSON.parse(strlp);
- var strcp = apppref.getpreference("pageconfig." + lp.view);
- var cp = JSON.parse(strcp);
- var ctab = "";
- //dump(JSON.stringify(cp) + "\n");
- //if (cp.activetab) {
- // ctab = cp.activetab;
- //}
- //var elx = maindoc.querySelectorAll('table[id^="cal_"]');
- for (var i in elx) {
- if (elx[i].id) {
- var elementdata = maindoc.getElementById(elx[i].id).innerHTML;
- //elementdata = elementdata.replace(/height:\ 0px;/g,'');
- //elementdata = elementdata.replace(/height:0;/g,'');
- $("#tbl_list").append(elementdata);
- //$("#tbl_list th:first-child").remove();
- //$("#tbl_list td:first-child").remove();
- }
- }
-
- //$('td').each(function(){
- // if($(this).attr('colspan') > 1){
- // var ccol = $(this).attr('colspan');
- // $(this).attr('colspan',ccol -1);
- // }
- //});
- //$('th').each(function(){
- // if($(this).attr('colspan') > 1){
- // var ccol = $(this).attr('colspan');
- // $(this).attr('colspan',ccol -1);
- // }
- //});
-
-
- //for (var i in elx) {
- // //dump(elx[i].id)
- // if ((elx[i].id ) && (elx[i].id.indexOf(ctab+"_wrapper") != -1)) {
- //
- // var elementdata = maindoc.getElementById(elx[i].id).innerHTML;
- //
- // elementdata = elementdata.replace(/height:\ 0px;/g,'');
- // elementdata = elementdata.replace(/height:0;/g,'');
- // elementdata = elementdata.replace(/colspan="1" rowspan="1"/g,'');
- // elementdata = elementdata.replace(/style="width:\s\d+px;"/g,'');
- //
- // var thead = elementdata.substring(elementdata.indexOf('<thead>'),elementdata.indexOf('</thead>')).replace('<thead>','');
- // var tbody = elementdata.substring(elementdata.indexOf('<tbody>'),elementdata.indexOf('</tbody>')).replace('<tbody>','');
- // var tfoot = elementdata.substring(elementdata.lastIndexOf('<tfoot>'),elementdata.lastIndexOf('</tfoot>')).replace('<tfoot>','');
- //
- // tcols = thead.split('</th>');
- //
- //
- //
- // $("#tbl_list > thead").append(thead);
- // $("#tbl_list > tbody").append(tbody);
- // $("#tbl_list > tfoot").append(tfoot);
- //
- // }
- //}
- // $("#tbl_list").dataTable({
- // "language": {
- // "url": "../../../web/js/locale/datatable_fr.json"
- // },
- // "paging": false,
- // "ordering": false,
- // "info": false,
- // "filter": false,
- // "destroy": true
- //});
-}
\ No newline at end of file
+++ /dev/null
-//Source-code licensed under EUPL v1.1 ( Copyright 2016 By DKS s.à r.l. - Kilian Saffran - Luxembourg )
-var printpdf = {
- //onLoad: function() {
- // // initialization code
- // this.initialized = true;
- // this.strings = document.getElementById("printpdf-strings");
- // this.prefs = Components.classes["@mozilla.org/preferences-service;1"]
- // .getService(Components.interfaces.nsIPrefBranch).getBranch("extensions.printpdf@pavlov.");
- //},
- onMenuItemCommand: function(fpath,fname,e) {
- var nsIFilePicker = Components.interfaces.nsIFilePicker;
- var picker = Components.classes["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);
- picker.init(window, "Save Document as PDF", nsIFilePicker.modeSave);
- picker.appendFilter("PDF", "*.pdf");
- picker.defaultExtension = "pdf";
- picker.defaultString = content.document.title;
-
- picker.show();
-
- var webBrowserPrint = window.content.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
- .getInterface(Components.interfaces.nsIWebBrowserPrint);
-
- var PSSVC = Components.classes["@mozilla.org/gfx/printsettings-service;1"]
- .getService(Components.interfaces.nsIPrintSettingsService);
-
- var printSettings = PSSVC.newPrintSettings;
-
- printSettings.printToFile = true;
- printSettings.toFileName = picker.file.path;
- printSettings.printSilent = true;
- printSettings.outputFormat = Components.interfaces.nsIPrintSettings.kOutputFormatPDF;
-
- // Added by bho
- //var myPrintPrefs = printpdf.getPrintingPrefs();
- printSettings.printBGColors = true;
- printSettings.printBGImages = true;
- printSettings.unwriteableMarginTop = 0.5;
- printSettings.unwriteableMarginLeft = 0.5;
- printSettings.unwriteableMarginBottom = 0.5;
- printSettings.unwriteableMarginRight = 0.5;
- printSettings.marginTop = 0.2; /* these are in inches */
- printSettings.marginLeft = 0.2;
- printSettings.marginBottom = 0.2;
- printSettings.marginRight = 0.2;
- //printSettings.shrinkToFit;
- printSettings.paperName = "iso_a4"; /* name of paper */
- printSettings.paperSizeType = 1; /* use native data or is defined here */
- //printSettings.paperData = 9; /* native data value */
- printSettings.orientation = 1;
- //"PDF Orientation:" + printSettings.orientation + "\n");
- if (printSettings.orientation == 1) {
- printSettings.paperWidth = 297.0; /* width of the paper in inches or mm */
- printSettings.paperHeight = 210.0; /* height of the paper in inches or mm */
-
- } else {
- printSettings.paperWidth = 210.0; /* width of the paper in inches or mm */
- printSettings.paperHeight = 297.0; /* height of the paper in inches or mm */
- }
- printSettings.paperSizeUnit = 1; /* paper is in inches or mm */
- //lets hide those ugly default headers
- printSettings.footerStrCenter = '';
- printSettings.footerStrLeft = '';
- printSettings.footerStrRight = '';
- printSettings.headerStrCenter = '';
- printSettings.headerStrLeft = '';
- printSettings.headerStrRight = '';
- //}
- // END: Added by bho
-
- webBrowserPrint.print(printSettings, null);
- }
- //onToolbarButtonCommand: function(e) {
- // // just reuse the function above. you can change this, obviously!
- // printpdf.onMenuItemCommand(e);
- //},
- //getPrintingPrefs: function (){
- // return {
- // showBGColor: this.prefs.getBoolPref("print.showBGColors"),
- // showBGImages: this.prefs.getBoolPref("print.showBGImages"),
- // showHeaders: this.prefs.getBoolPref("print.showHeaders")
- // };
- //}
-
-};
-//window.addEventListener("load", function(e) { printpdf.onLoad(e); }, false);
+++ /dev/null
-//Source-code licensed under EUPL v1.1 ( Copyright 2016 By DKS s.à r.l. - Kilian Saffran - Luxembourg )
-var printmanager = {
- onprint: function() {
- var sprdata = apppref.getpreference("pageconfig.lastpage");
- var prdata = JSON.parse(sprdata);
- var spldata = apppref.getpreference("pageconfig." + prdata.view);
- var pldata = JSON.parse(spldata);
- if (!pldata.printlayout) {
- //dump(prdata.module +" "+prdata.view+": Sorry, no printlayout defined!\n");
- }else {
- //dump(JSON.stringify(pldata) + "\n");
- printmanager.load_printpreview("chrome://creorga/content/modules/reports/print_" +pldata.printlayout + ".html");
- }
- },
- load_pdf: function(data){
- var params = { in : {
- "uri": data.uri
- },
- out: null
- };
- var dlg = window.openDialog("chrome://creorga/content/modules/reports/dlg/dlgpdfviewer.xul", "dlgpdfviewer",
- "chrome,centerscreen,resizable,scrollbars", params).focus();
- if (params.out) {
- //code
- }
- },
- load_printpreview: function(path) {
- var params = { in : {
- "uri": path
- },
- out: null
- };
- var dlg = window.openDialog("chrome://creorga/content/modules/reports/dlg/dlgprint.xul", "dlgprint",
- "chrome,centerscreen,resizable,scrollbars,modal", params).focus();
- if (params.out) {
- if (params.out.reload == true) {
- printmanager.load_printpreview(params.in.uri,params.in.type);
- }
- }
- },
-}
\ No newline at end of file
+++ /dev/null
-<!DOCTYPE html>
-
-<html>
-<head>
- <title>Creorga - Enfant</title>
- <meta charset="UTF-8">
- <meta http-equiv="cache-control" content="max-age=0" />
- <meta http-equiv="cache-control" content="no-cache" />
- <meta http-equiv="expires" content="0" />
- <meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT" />
- <meta http-equiv="pragma" content="no-cache" />
- <link href="../../web/css/bootstrap.min.css" rel="stylesheet" type="text/css">
- <!--<link href="../../web/css/bootstrap-theme.min.css" rel="stylesheet" type="text/css">-->
- <link href="../../web/css/jquery.dataTables.min.css" rel="stylesheet" type="text/css">
- <link href="../../web/css/jquery.dataTables_themeroller.css" rel="stylesheet" type="text/css">
- <link href="css/print.css" rel="stylesheet" type="text/css">
-</head>
-
-<body>
- <div style="width: 100%;">
- <table style="width: 100%;" id="pagehead"><tr><td style="width: 200px; text-align: left; ">
- <img src="img/logoprint.png" />
- </td>
- <td style="text-align: center;"><h2 id="title_main"></h2><h3 id="title_sub"></h3></td>
- <td style="text-align: right;">
- <div style="text-align: left;"><span id="creche_name">Creche</span><br/>
- <span id="creche_address">address</span><br/>
- <span id="creche_zip">CP</span> <span id="creche_city">City</span></div>
- </td>
- </tr>
- </table>
- </div>
- <div id="bookdata">
-
- </div>
- <script src="../../web/js/jquery.min.js" type="text/javascript"></script>
- <script src="../../web/js/datatables.min.js" type="text/javascript"></script>
- <script src="chrome://creorga/content/js/preferences.js" type="text/javascript"></script>
- <script src="chrome://creorga/content/js/database.js" type="text/javascript"></script>
- <script src="js/print.js" type="text/javascript"></script>
- <script src="js/print_book.js" type="text/javascript"></script>
-</body>
-</html>
\ No newline at end of file
+++ /dev/null
-<!DOCTYPE html>
-
-<html>
-<head>
- <title>Creorga - Printing - List</title>
- <meta charset="UTF-8">
- <meta http-equiv="cache-control" content="max-age=0" />
- <meta http-equiv="cache-control" content="no-cache" />
- <meta http-equiv="expires" content="0" />
- <meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT" />
- <meta http-equiv="pragma" content="no-cache" />
- <link href="../../web/css/bootstrap.min.css" rel="stylesheet" type="text/css">
- <!--<link href="../../web/css/bootstrap-theme.min.css" rel="stylesheet" type="text/css">-->
- <link href="../../web/css/jquery.dataTables.min.css" rel="stylesheet" type="text/css">
- <!--<link href="../../web/css/jquery.dataTables_themeroller.css" rel="stylesheet" type="text/css">-->
- <link href="css/print.css" rel="stylesheet" type="text/css">
- <link href="../../web/css/calendar.css" rel="stylesheet" type="text/css">
- <style>
- .panel-daybody {
- height: 10.5vh;
- max-height: 10.5vh;
- overflow-y: auto;
- padding: 3px;
-}
- </style>
-</head>
-
-<body>
- <div style="width: 100%;">
- <table style="width: 100%;" id="pagehead"><tr><td style="width: 200px; text-align: left;">
- <img src="img/logoprint.png" />
- </td>
- <td style="text-align: center;"><h2 id="title_main"></h2><h3 id="title_sub"></h3></td>
- <td style="text-align: right; ">
- <div style="text-align: left;"><span id="creche_name">Creche</span><br/>
- <span id="creche_address">address</span><br/>
- <span id="creche_zip">CP</span> <span id="creche_city">City</span></div>
- </td>
- </tr>
- </table>
- </div>
- <table class="table table-bordered" id="cal_month" style="width: 100%;">
- </table>
-
- <script src="../../web/js/jquery.min.js" type="text/javascript"></script>
- <script src="../../web/js/datatables.min.js" type="text/javascript"></script>
- <script src="chrome://creorga/content/js/preferences.js" type="text/javascript"></script>
- <script src="chrome://creorga/content/js/database.js" type="text/javascript"></script>
- <script src="js/print.js" type="text/javascript"></script>
- <script src="js/print_calendar.js" type="text/javascript"></script>
- <script src="../../web/js/labels.js" type="text/javascript"></script>
-</body>
-</html>
\ No newline at end of file
+++ /dev/null
-<!DOCTYPE html>
-
-<html>
-<head>
- <title>Creorga - Enfant</title>
- <meta charset="UTF-8">
- <meta http-equiv="cache-control" content="max-age=0" />
- <meta http-equiv="cache-control" content="no-cache" />
- <meta http-equiv="expires" content="0" />
- <meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT" />
- <meta http-equiv="pragma" content="no-cache" />
- <link href="../../web/css/bootstrap.min.css" rel="stylesheet" type="text/css">
- <!--<link href="../../web/css/bootstrap-theme.min.css" rel="stylesheet" type="text/css">-->
- <link href="../../web/css/jquery.dataTables.min.css" rel="stylesheet" type="text/css">
- <link href="../../web/css/jquery.dataTables_themeroller.css" rel="stylesheet" type="text/css">
- <link href="css/print.css" rel="stylesheet" type="text/css">
-</head>
-
-<body>
- <div style="width: 100%;">
- <table style="width: 100%;" id="pagehead"><tr><td style="width: 200px; text-align: left; ">
- <img src="img/logoprint.png" />
- </td>
- <td style="text-align: center;"><h2 id="title_main"></h2><h3 id="title_sub"></h3></td>
- <td style="text-align: right;">
- <div style="text-align: left;"><span id="creche_name">Creche</span><br/>
- <span id="creche_address">address</span><br/>
- <span id="creche_zip">CP</span> <span id="creche_city">City</span></div>
- </td>
- </tr>
- </table>
- </div>
- <div id="childdata" style="margin-top: 20px;">
- <h2>Données de base</h2>
- <table class="table table-striped">
- <tbody>
- <tr><td>Prénom</td><th id="childs_prename"></th></tr>
- <tr><td>Nom</td><th id="childs_surname"></th></tr>
- <tr><td>Date de naissance</td><th id="childs_birthday"></th></tr>
- <tr><td>No. Check Service</td><th id="childs_checkservicenumber"></th></tr>
- <tr><td>Date d'expiration</td><th id="childs_checkserviceexpiration"></th></tr>
- <tr><td>No. Client</td><th id="childs_clientnumber"></th></tr>
- <tr><td>Addresse</td><th id="childs_address"></th></tr>
- <tr><td>Code Postale</td><th id="childs_zip"></th></tr>
- <tr><td>Ville</td><th id="childs_city"></th></tr>
- <tr><td>Pays</td><th id="childs_country"></th></tr>
- <tr><td>Nationalité</td><th id="childs_nationality"></th></tr>
- <tr><td>Langue maternelle</td><th id="childs_nativelanguage"></th></tr>
- <tr><td>Remarque</td><th id="childs_remark"></th></tr>
- </tbody>
- </table>
- </div>
-
- <div id="parentdata" style="padding-top: 20px;">
- <h2>Données parents / personnes de référence</h2>
- <div id="tbl_parents_wrapper" class="dataTables_wrapper" style="width: 100%;">
-
- <table class="display dataTable cell-border" style="width: 100%;" id="tbl_parents" role="grid">
-
- </table>
- </div>
- </div>
-
- <div id="refpersondata" style="padding-top: 20px;">
- <h2>Données personnes de réferences/authorisées</h2>
- <div id="tbl_refpersons_wrapper" class="dataTables_wrapper" style="width: 100%;">
-
- <table class="display dataTable cell-border" style="width: 100%;" id="tbl_refpersons" role="grid">
-
- </table>
- </div>
- </div>
-
- <div id="planningdata" style="padding-top: 20px;">
- <h2>Info Planning</h2>
- <table>
- <tbody>
- <tr><td>Date d'entrée</td><td id="childs_entrydate"></td></tr>
- <tr><td>Date de sortie</td><td id="childs_leavedate"></td></tr>
-
- </tbody>
- </table>
- <div id="tbl_planning_wrapper" class="dataTables_wrapper" style="width: 100%;">
-
- <table class="display dataTable cell-border" style="width: 100%;" id="tbl_planning" role="grid">
-
- </table>
- </div>
- </div>
-
- <div id="healthdata" style="padding-top: 20px;">
- <h2>Info Santé</h2>
- <table class="table table-striped">
- <tbody>
- <tr><td>Médecin de famille</td><th id="health_docname"></th></tr>
- <tr><td>Téléphone</td><th id="health_docphone"></th></tr>
- <tr><td>Adr. cabinet</td><th id="health_docaddress"></th></tr>
- <tr><td>Code Postale</td><th id="health_doczip"></th></tr>
- <tr><td>Ville</td><th id="health_doccity"></th></tr>
- <tr><td>Pays</td><th id="health_doccountry"></th></tr>
- <tr><td>Info Santé</td><th id="health_healthinfo"></th></tr>
- </tbody>
- </table>
- </div>
-
- <div id="financedata" style="padding-top: 20px;">
- <h2>Info fincances/caution</h2>
- <table class="table table-striped">
- <tbody>
- <tr><td>Somme totale</td><td id="health_docname"></td></tr>
- <tr><td>Somme payé</td><td id="health_docphone"></td></tr>
- <tr><td>Somme remboursé</td><td id="health_docaddress"></td></tr>
- <tr><td>Date Status</td><td id="health_doczip"></td></tr>
- <tr><td>Compte bancaire</td><td id="health_doccity"></td></tr>
- <tr><td>BIC</td><td id="health_doccountry"></td></tr>
- <tr><td>Remarque</td><td id="health_healthinfo"></td></tr>
- </tbody>
- </table>
- </div>
-
-
-
- <!--<div id="print-foot">
- Date: <span id="printdatetime">00.00.0000 00:00</span> - Page:
- </div>-->
- <script src="../../web/js/jquery.min.js" type="text/javascript"></script>
- <script src="../../web/js/datatables.min.js" type="text/javascript"></script>
- <script src="chrome://creorga/content/js/preferences.js" type="text/javascript"></script>
- <script src="chrome://creorga/content/js/database.js" type="text/javascript"></script>
- <script src="js/print.js" type="text/javascript"></script>
- <script src="js/print_child.js" type="text/javascript"></script>
- <script src="../../web/js/labels.js" type="text/javascript"></script>
-</body>
-</html>
\ No newline at end of file
+++ /dev/null
-<!DOCTYPE html>
-
-<html>
-<head>
- <title>Creorga - Printing - List</title>
- <meta charset="UTF-8">
- <meta http-equiv="cache-control" content="max-age=0" />
- <meta http-equiv="cache-control" content="no-cache" />
- <meta http-equiv="expires" content="0" />
- <meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT" />
- <meta http-equiv="pragma" content="no-cache" />
- <link href="../../web/css/bootstrap.min.css" rel="stylesheet" type="text/css">
- <!--<link href="../../web/css/bootstrap-theme.min.css" rel="stylesheet" type="text/css">-->
- <link href="../../web/css/datatables.min.css" rel="stylesheet" type="text/css">
- <link href="../../web/css/glyphicons.css" rel="stylesheet">
- <!--<link href="../../web/css/jquery.dataTables_themeroller.css" rel="stylesheet" type="text/css">-->
- <link href="css/print.css" rel="stylesheet" type="text/css">
- <link href="../../web/css/calendar.css" rel="stylesheet" type="text/css">
-</head>
-
-<body>
- <div style="width: 100%;">
- <table style="width: 100%;" id="pagehead"><tr><td style="width: 200px; text-align: left;">
- <img src="img/logoprint.png" />
- </td>
- <td style="text-align: center;"><h2 id="title_main"></h2><h3 id="title_sub"></h3></td>
- <td style="text-align: right; ">
- <div style="text-align: left;"><span id="creche_name">Creche</span><br/>
- <span id="creche_address">address</span><br/>
- <span id="creche_zip">CP</span> <span id="creche_city">City</span></div>
- </td>
- </tr>
- </table>
- </div>
- <table class="dataTable row-border cell-border stripe" tyle="width: 100%;" id="tbl_list" role="grid">
- <thead style="margin-top: 200px;"></thead>
- <tbody>
-
- </tbody>
- <tfoot>
-
- </tfoot>
- </table>
- <!--<div id="print-head" style="width: 100%;">
- <table style="width: 100%;" id="pagehead"><tr><td style="width: 200px; text-align: left;">
- <img src="img/logoprint.png" />
- </td>
- <td style="text-align: center;"><h2 id="title_main"></h2><h3 id="title_sub"></h3></td>
- <td style="text-align: right; ">
- <div style="text-align: left;"><span id="creche_name">Creche</span><br/>
- <span id="creche_address">address</span><br/>
- <span id="creche_zip">CP</span> <span id="creche_city">City</span></div>
- </td>
- </tr>
- </table>
- </div>-->
- <!--<div id="print-foot">
- Date: <span id="printdatetime">00.00.0000 00:00</span> - Page:
- </div>-->
- <script src="../../web/js/jquery.min.js" type="text/javascript"></script>
- <script src="../../web/js/bootstrap.min.js" type="text/javascript"></script>
- <script src="../../web/js/datatables.min.js" type="text/javascript"></script>
- <script src="chrome://creorga/content/js/preferences.js" type="text/javascript"></script>
- <script src="chrome://creorga/content/js/database.js" type="text/javascript"></script>
- <script src="js/print.js" type="text/javascript"></script>
- <script src="js/print_loaddata.js" type="text/javascript"></script>
- <script src="../../web/js/labels.js" type="text/javascript"></script>
-</body>
-</html>
+++ /dev/null
-<!DOCTYPE html>
-
-<html>
-<head>
- <title>Creorga - Logbook</title>
- <meta charset="UTF-8">
- <meta http-equiv="cache-control" content="max-age=0" />
- <meta http-equiv="cache-control" content="no-cache" />
- <meta http-equiv="expires" content="0" />
- <meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT" />
- <meta http-equiv="pragma" content="no-cache" />
- <link href="../../web/css/bootstrap.min.css" rel="stylesheet" type="text/css">
- <link href="css/print.css" rel="stylesheet" type="text/css">
- <style>
- .panel-heading {
- background-color: #969696 !important;
- }
- </style>
-</head>
-
-<body>
- <div style="width: 100%;">
- <table style="width: 100%;" id="pagehead"><tr><td style="width: 200px; text-align: left; ">
- <img src="img/logoprint.png" />
- </td>
- <td style="text-align: center;"><h2 id="title_main"></h2><h3 id="title_sub"></h3></td>
- <td style="text-align: right;">
- <div style="text-align: left;"><span id="creche_name">Creche</span><br/>
- <span id="creche_address">address</span><br/>
- <span id="creche_zip">CP</span> <span id="creche_city">City</span></div>
- </td>
- </tr>
- </table>
- </div>
- <div id="div_data" style="margin-top: 20px;"></div>
- <script src="../../web/js/jquery.min.js" type="text/javascript"></script>
- <!--<script src="../../web/js/datatables.min.js" type="text/javascript"></script>-->
- <script src="chrome://creorga/content/js/preferences.js" type="text/javascript"></script>
- <script src="chrome://creorga/content/js/database.js" type="text/javascript"></script>
- <script src="js/print.js" type="text/javascript"></script>
- <script src="js/print_logchild.js" type="text/javascript"></script>
- <script src="../../web/js/labels.js" type="text/javascript"></script>
-</body>
-</html>
\ No newline at end of file
+++ /dev/null
-<!DOCTYPE html>
-
-<html>
-<head>
- <title>Creorga - Printing - MultiList</title>
- <meta charset="UTF-8">
- <meta http-equiv="cache-control" content="max-age=0" />
- <meta http-equiv="cache-control" content="no-cache" />
- <meta http-equiv="expires" content="0" />
- <meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT" />
- <meta http-equiv="pragma" content="no-cache" />
- <link href="../../web/css/bootstrap.min.css" rel="stylesheet" type="text/css">
- <!--<link href="../../web/css/bootstrap-theme.min.css" rel="stylesheet" type="text/css">-->
- <link href="../../web/css/datatables.min.css" rel="stylesheet" type="text/css">
- <!--<link href="../../web/css/glyphicons.css" rel="stylesheet">-->
- <!--<link href="../../web/css/jquery.dataTables_themeroller.css" rel="stylesheet" type="text/css">-->
- <link href="css/print.css" rel="stylesheet" type="text/css">
- <style>
- .mpage {
- page-break-after: always;
- }
- </style>
-</head>
-
-<body>
- <div id="allpages">
- <div id="page_xxnum" class="mpage">
- <div style="width: 100%;">
- <table style="width: 100%;" id="pagehead"><tr><td style="width: 200px; text-align: left;">
- <img src="img/logoprint.png" />
- </td>
- <td style="text-align: center;"><h2 id="title_main"></h2><h3 id="title_sub"></h3></td>
- <td style="text-align: right; ">
- <div style="text-align: left;"><span id="creche_name">Creche</span><br/>
- <span id="creche_address">address</span><br/>
- <span id="creche_zip">CP</span> <span id="creche_city">City</span></div>
- </td>
- </tr>
- </table>
- </div>
- <h2 id="page_title"></h2>
- <table class="dataTable row-border cell-border stripe" tyle="width: 100%;" id="tbl_list_xxnum" role="grid">
- <thead style="margin-top: 200px;"></thead>
- <tbody>
-
- </tbody>
- <tfoot>
-
- </tfoot>
-
- </table>
- </div>
- </div>
- <script src="../../web/js/jquery.min.js" type="text/javascript"></script>
- <script src="../../web/js/bootstrap.min.js" type="text/javascript"></script>
- <script src="../../web/js/datatables.min.js" type="text/javascript"></script>
- <script src="chrome://creorga/content/js/preferences.js" type="text/javascript"></script>
- <script src="chrome://creorga/content/js/database.js" type="text/javascript"></script>
- <script src="js/print.js" type="text/javascript"></script>
- <script src="js/print_multilist.js" type="text/javascript"></script>
- <script src="../../web/js/labels.js" type="text/javascript"></script>
-</body>
-</html>
+++ /dev/null
-<!DOCTYPE html>
-
-<html>
-<head>
- <title>Creorga - Printing - Table</title>
- <meta charset="UTF-8">
- <meta http-equiv="cache-control" content="max-age=0" />
- <meta http-equiv="cache-control" content="no-cache" />
- <meta http-equiv="expires" content="0" />
- <meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT" />
- <meta http-equiv="pragma" content="no-cache" />
- <link href="../../web/css/bootstrap.min.css" rel="stylesheet" type="text/css">
- <!--<link href="../../web/css/bootstrap-theme.min.css" rel="stylesheet" type="text/css">-->
- <!--<link href="../../web/css/datatables.min.css" rel="stylesheet" type="text/css">-->
- <link href="../../web/css/glyphicons.css" rel="stylesheet">
- <!--<link href="../../web/css/jquery.dataTables_themeroller.css" rel="stylesheet" type="text/css">-->
- <link href="css/print.css" rel="stylesheet" type="text/css">
- <link href="../../web/css/calendar.css" rel="stylesheet" type="text/css">
-</head>
-
-<body>
- <div style="width: 100%;">
- <table style="width: 100%;" id="pagehead"><tr><td style="width: 200px; text-align: left;">
- <img src="img/logoprint.png" />
- </td>
- <td style="text-align: center;"><h2 id="title_main"></h2><h3 id="title_sub"></h3></td>
- <td style="text-align: right; ">
- <div style="text-align: left;"><span id="creche_name">Creche</span><br/>
- <span id="creche_address">address</span><br/>
- <span id="creche_zip">CP</span> <span id="creche_city">City</span></div>
- </td>
- </tr>
- </table>
- </div>
- <table class="table table-bordered table-striped" style="width: 100%;" id="tbl_list" role="grid">
-
- </table>
- <script src="../../web/js/jquery.min.js" type="text/javascript"></script>
- <script src="chrome://creorga/content/js/preferences.js" type="text/javascript"></script>
- <script src="chrome://creorga/content/js/database.js" type="text/javascript"></script>
- <script src="js/print.js" type="text/javascript"></script>
- <script src="js/print_table.js" type="text/javascript"></script>
- <script src="../../web/js/labels.js" type="text/javascript"></script>
-</body>
-</html>
+++ /dev/null
-<?xml version="1.0"?>
-<!DOCTYPE overlay PUBLIC "-//MOZILLA//DTD XUL V1.0//EN"
-"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
-<overlay id="ov_reports" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:html="http://www.w3.org/1999/xhtml">
- <script type="application/javascript" src="chrome://creorga/content/modules/reports/js/printutils.js" />
- <script type="application/javascript" src="chrome://creorga/content/modules/reports/js/printpdf.js" />
- <toolbar id="co_maintoolbar" style="-moz-appearance: none;">
- <toolbarbutton class="btn btn-default" id="tbb_print" insertafter="tbb_space" label="Impression" image="modules/reports/img/print.png" orient="vertical" oncommand="printmanager.onprint();"/>
- </toolbar>
-</overlay>
\ No newline at end of file
</head>
<body>
<nav class="navbar navbar-expand-md navbar-dark fixed-top bg-dark">
- <a class="navbar-brand" href="#">Creorga</a>
+ <a class="navbar-brand" href="#">Configuration</a>
<div class="ml-auto">
<div class="btn-group" role="group" aria-label="Basic example">
+ <button class="btn btn-primary" onclick="db_import();"><i class="fas fa-plus"></i><br/>importer</button>
+ <button class="btn btn-primary" onclick="db_export();"><i class="fas fa-plus"></i><br/>exporter</button>
+ <button class="btn btn-primary" onclick="db_new();"><i class="fas fa-plus"></i><br/>nouv.</button>
+ <button class="btn btn-primary" onclick="db_edit();"><i class="fas fa-edit"></i><br/>édit.</button>
+ <button class="btn btn-primary" onclick="db_delete();"><i class="fas fa-trash"></i><br/>suppr.</button>
+ <button class="btn btn-primary" onclick="db_test();"><i class="fas fa-plus"></i><br/>Tester Connection</button>
</div>
</div>
</nav>
<div class="cotainer-fluid" style="margin-top: 52px;">
-
- <div class="row">
+ <table id="tbl_childs" class="table table-bordered table-hover table-striped">
+ <thead class="thead-dark">
+ <th data-checkbox="true"></th>
+ <th data-sortable="true">Nom</th>
+ <th data-sortable="true">Type</th>
+ <th data-sortable="true">VPN</th>
+ <th data-sortable="true">URL</th>
+ <th data-sortable="true">Status</th>
+ <tfoot></tfoot>
+ <tbody></tbody>
+ </table>
+ <!-- <div class="row">
<div class="col-sm-12">
<div class="card">
<div class="card-heading">
</div>
</div>
</div>
- </div>
+ </div> -->
</div>
<script>if (typeof module === 'object') {window.module = module; module = undefined;}</script>
<script src="../../node_modules/jquery/dist/jquery.min.js" type="text/javascript"></script>
<script src="../../node_modules/bootstrap-table/dist/bootstrap-table.min.js"></script>
<script src="../../node_modules/@fortawesome/fontawesome-free/js/all.min.js"></script>
<script src="../../js/moduleglobal.js"></script>
- <script src="../../js/database.js"></script>
+ <!-- <script src="../../js/database.js"></script> -->
<!--<script src="chrome://creorga/content/js/tools.js" type="text/javascript"></script>-->
<!-- <script src="js/creorga.js" type="text/javascript"></script> -->
<!-- <script src="js/labels.js" type="text/javascript"></script> -->
<script src="index.js" type="text/javascript"></script>
+ <script src="dbconfig.js" type="text/javascript"></script>
<script>if (window.module) module = window.module;</script>
</body>
</html>
--- /dev/null
+function initpage(){
+ console.log("Loading Settings!");
+}
+
+function db_new(){
+ parent.userapp.loadmodulepage('settings','db',null);
+}
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<html lang="en">
+<head>
+<meta charset="UTF-8">
+<meta name="viewport" content="width=device-width, initial-scale=1.0">
+<link rel="stylesheet" href="../../node_modules/bootstrap/dist/css/bootstrap.min.css">
+<link rel="stylesheet" href="../../node_modules/bootstrap-table/dist/bootstrap-table.min.css">
+<link rel="stylesheet" href="../../node_modules/@fortawesome/fontawesome-free/css/fontawesome.min.css">
+<link rel="stylesheet" href="../../css/invoicejournal.epic.css">
+<link rel="stylesheet" href="../../css/app.css">
+<title>Datenbank-Einstellungen</title>
+</head>
+<body>
+ <nav class="navbar navbar-expand-md navbar-dark fixed-top bg-dark">
+ <button class="btn btn-primary" onclick="parent.browserapp.loadmodule('settings');"><i class="fas fa-chevron-left"></i><br>Back</button>
+ <a class="navbar-brand" href="#"> Datenbank-Einstellungen</a>
+ <div class="ml-auto">
+
+ <div class="btn-group" role="group" aria-label="Basic example">
+ <button class="btn btn-primary" onclick="datastore.save();"><i class="fas fa-save"></i><br/>Speichern</button>
+ <button class="btn btn-primary" onclick="datastore.test();"><i class="fas fa-sync"></i><br/>Testen</button>
+ <button class="btn btn-danger" onclick="datastore.test();" id="btnconnection"><i class="fas fa-wifi"></i><br/>Verbinden</button>
+
+ </div>
+ </div>
+ </nav>
+ <div class="cotainer-fluid" style="margin-top: 52px;">
+ <div class="row">
+ <div class="col-md-12">
+ <div class="card">
+ <div class="card-body">
+ <div class="form-group">
+ <label for="name" >Name</label>
+ <input type="text" class="form-control" id="name" name="name"/>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ <div class="row">
+ <div class="col-md-4">
+ <div class="card">
+ <div class="card-header"> Verbindung </div>
+ <div class="card-body">
+ <div class="form-group">
+ <label for="type">Verbindungs-Typ</label>
+ <select id="type" name="type" class="form-control">
+ <option value="local">Lokal</option>
+ <option value="local">LAN</option>
+ <option value="Cloud">Cloud</option>
+ </select>
+ </div>
+ <div class="form-group">
+ <label for="server">Server</label>
+ <input type="text" class="form-control" id="server" name="server"/>
+ </div>
+ <div class="form-group">
+ <label for="dbfile">Datenbank</label>
+ <input type="text" class="form-control" id="dbfile" name="dbfile"/>
+ </div>
+ <div class="form-group">
+ <label for="type">VPN</label>
+ <select id="vpn" name="vpn" class="form-control">
+ <option value=""></option>
+ </select>
+ </div>
+ </div>
+ </div>
+ </div>
+ <div class="col-md-4">
+ <div class="card">
+ <div class="card-header">
+ Standard Werte
+ </div>
+ <div class="card-body">
+ <div class="form-group">
+ <label for="dbname">Mehrwert-Steuer(%)</label>
+ <input type="text" class="form-control" id="vat" name="vat"/>
+ </div>
+ <div class="form-group">
+ <label for="dbname">Währung (Symbol)</label>
+ <input type="text" class="form-control" id="currency" name="currency"/>
+ </div>
+ </div>
+ </div>
+ </div>
+ <div class="col-md-4">
+ <div class="card">
+ <div class="card-header">
+ E-Mail Server
+ </div>
+ <div class="card-body">
+ <div class="form-group">
+ <label for="mailserver">Email-Server</label>
+ <input type="text" class="form-control" id="mailserver" name="mailserver"/>
+ </div>
+ <div class="form-group">
+ <label for="mailport">Verschlüsselung/Port</label>
+ <div class="input-group">
+ <select id="mailencryption" name="mailencryption" class="form-control">
+ <option value="">None</option>
+ <option value="TLS">TLS</option>
+ <option value="SSL">SSL</option>
+ </select>
+ <input type="text" class="form-control" id="mailport" name="mailport"/>
+ </div>
+ </div>
+ <div class="form-group">
+ <label for="maillogin">Login</label>
+ <input type="text" class="form-control" id="maillogin" name="maillogin"/>
+ </div>
+ <div class="form-group">
+ <label for="mailpassword">Passwort</label>
+ <input type="password" class="form-control" id="mailpassword" name="mailpassword"/>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+
+<script>if (typeof module === 'object') {window.module = module; module = undefined;}</script>
+<script src="../../node_modules/jquery/dist/jquery.min.js"></script>
+<script src="../../node_modules/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
+<script src="../../node_modules/bootstrap-table/dist/bootstrap-table.min.js"></script>
+<script src="../../node_modules/@fortawesome/fontawesome-free/js/all.min.js"></script>
+<script src="../../js/moduleglobal.js"></script>
+<script src="../../js/database.js"></script>
+<script src="form_datastore.js"></script>
+<script src="lib/datastore.js"></script>
+<script src="lib/printtemplate.js"></script>
+<script src="lib/emailtemplate.js"></script>
+<script>if (window.module) module = window.module;</script>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+function initpage(){
+ console.log("ID:" + mpref.cfg.id);
+ if (mpref.cfg.id){
+ loadform();
+ }
+}
+
+function loadform(){
+ var pref = parent.usersystem.getPreference(mpref.cfg.id);
+ console.log(pref);
+ for (var i in pref){
+ $("#" + i).val(pref[i]);
+ }
+}
<!DOCTYPE html>
-<html>
- <head>
- <title>Dashboard</title>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <link href="../../node_modules/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet" type="text/css">
- <link href="../../node_modules/bootstrap-table/dist/bootstrap-table.min.css" rel="stylesheet" type="text/css">
- <link href="../../node_modules/@fortawesome/fontawesome-free/css/fontawesome.min.css" rel="stylesheet" type="text/css">
- <link href="../../css/creorga.epic.css" rel="stylesheet" type="text/css">
- <link href="../../css/app.css" rel="stylesheet" type="text/css">
- </head>
- <body>
- <nav class="navbar navbar-expand-md navbar-dark fixed-top bg-dark">
- <a class="navbar-brand" href="#">Configuration</a>
- <div class="ml-auto">
- <div class="btn-group" role="group" aria-label="Basic example">
- <button class="btn btn-primary" onclick="db_import();"><i class="fas fa-plus"></i><br/>importer</button>
- <button class="btn btn-primary" onclick="db_export();"><i class="fas fa-plus"></i><br/>exporter</button>
- <button class="btn btn-primary" onclick="db_new();"><i class="fas fa-plus"></i><br/>nouv.</button>
- <button class="btn btn-primary" onclick="db_edit();"><i class="fas fa-edit"></i><br/>édit.</button>
- <button class="btn btn-primary" onclick="db_delete();"><i class="fas fa-trash"></i><br/>suppr.</button>
- <button class="btn btn-primary" onclick="db_test();"><i class="fas fa-plus"></i><br/>Tester Connection</button>
- </div>
- </div>
- </nav>
- <div class="cotainer-fluid" style="margin-top: 52px;">
- <table id="tbl_childs" class="table table-bordered table-hover table-striped">
- <thead class="thead-dark">
- <th data-checkbox="true"></th>
- <th data-sortable="true">Nom</th>
- <th data-sortable="true">Type</th>
- <th data-sortable="true">VPN</th>
- <th data-sortable="true">URL</th>
- <th data-sortable="true">Status</th>
- <tfoot></tfoot>
- <tbody></tbody>
- </table>
- <!-- <div class="row">
- <div class="col-sm-12">
- <div class="card">
- <div class="card-heading">
- <h3 class="cadr-title"> Informations Utiles</h3>
- </div>
- <div class="card-body" id="infopanel">
- pas d'informations utiles pour l'instant!
- </div>
- </div>
- </div>
- </div> -->
- </div>
- <script>if (typeof module === 'object') {window.module = module; module = undefined;}</script>
- <script src="../../node_modules/jquery/dist/jquery.min.js" type="text/javascript"></script>
- <script src="../../node_modules/bootstrap/dist/js/bootstrap.bundle.min.js" type="text/javascript"></script>
- <script src="../../node_modules/bootstrap-table/dist/bootstrap-table.min.js"></script>
- <script src="../../node_modules/@fortawesome/fontawesome-free/js/all.min.js"></script>
- <script src="../../js/moduleglobal.js"></script>
- <!-- <script src="../../js/database.js"></script> -->
- <!--<script src="chrome://creorga/content/js/tools.js" type="text/javascript"></script>-->
- <!-- <script src="js/creorga.js" type="text/javascript"></script> -->
- <!-- <script src="js/labels.js" type="text/javascript"></script> -->
- <script src="index.js" type="text/javascript"></script>
- <script src="dbconfig.js" type="text/javascript"></script>
- <script>if (window.module) module = window.module;</script>
- </body>
-</html>
+<html lang="en">
+<head>
+<meta charset="UTF-8">
+<meta name="viewport" content="width=device-width, initial-scale=1.0">
+<link rel="stylesheet" href="../../node_modules/bootstrap/dist/css/bootstrap.min.css">
+<link rel="stylesheet" href="../../node_modules/bootstrap-table/dist/bootstrap-table.min.css">
+<link rel="stylesheet" href="../../node_modules/@fortawesome/fontawesome-free/css/fontawesome.min.css">
+<link rel="stylesheet" href="../../css/invoicejournal.epic.css">
+<link rel="stylesheet" href="../../css/app.css">
+<title>Einstellungen</title>
+</head>
+<body>
+ <nav class="navbar navbar-expand-md navbar-dark fixed-top bg-dark">
+ <a class="navbar-brand" href="#">Einstellungen</a>
+ <div class="ml-auto">
+ <div class="btn-group" role="group" aria-label="Basic example">
+ <button class="btn btn-primary" onclick="datastore.import();"><i class="fas fa-file-import"></i><br/>importieren</button>
+ <button class="btn btn-primary" onclick="datastore.export();"><i class="fas fa-file-export"></i><br/>exportieren</button>
+ <button class="btn btn-primary" onclick="datastore.new();"><i class="fas fa-plus"></i><br/>Neu</button>
+ <button class="btn btn-primary" onclick="datastore.edit();"><i class="fas fa-edit"></i><br/>Bearb.</button>
+ <button class="btn btn-primary" onclick="datastore.delete();"><i class="fas fa-trash"></i><br/>Löschen</button>
+ </div>
+ </div>
+ </nav>
+ <div class="cotainer-fluid" style="margin-top: 52px;">
+ <!-- <button class="btn btn-secondary" onclick="parent.usersystem.showError('MyError','My Error Message from settings!');">Show Error</button> -->
+ <table class="table table-bordered table-hover table-striped" id="tbl_datasets">
+ <thead class="thead-dark">
+ <tr>
+ <th data-checkbox="true"></th>
+ <th data-sortable="true">Name</th>
+ <th data-sortable="true">Database</th>
+ <th data-sortable="true">Server</th>
+ <th data-sortable="true">Type</th>
+ <th data-sortable="true">VPN</th>
+ <th>Verbunden</th>
+ </tr>
+ </thead>
+ <tfoot></tfoot>
+ <tbody></tbody>
+ </table>
+ </div>
+<script>if (typeof module === 'object') {window.module = module; module = undefined;}</script>
+<script src="../../node_modules/jquery/dist/jquery.min.js"></script>
+<script src="../../node_modules/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
+<script src="../../node_modules/bootstrap-table/dist/bootstrap-table.min.js"></script>
+<script src="../../node_modules/@fortawesome/fontawesome-free/js/all.min.js"></script>
+<script src="../../js/moduleglobal.js"></script>
+<script src="../../js/database.js"></script>
+<script src="lib/datastore.js"></script>
+<script src="index.js"></script>
+<script>if (window.module) module = window.module;</script>
+</body>
+</html>
\ No newline at end of file
+var winh = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
+var tblh = winh-54;
+
function initpage(){
- console.log("Loading Settings!");
+ console.log(parent.usersystem.getsysinfo());
+ loadtable();
+ //parent.usersystem.setProperty("testproperty",{id:"TEST"});
+}
+
+function loadtable(){
+
+ var connected=parent.browserapp.currentdataset();
+
+ var localds = parent.usersystem.getLocalDataSets();
+ console.log(localds);
+ for (var i in localds){
+ var prop = parent.usersystem.getPreference(localds[i]);
+ console.log("PROP");
+ console.log(connected +"<=>"+ localds[i]);
+
+ console.log(prop);
+ var row = '<tr id="' + localds[i] + '">' +
+ '<td></td>' +
+ '<td>'+prop.name+'</td>' +
+ '<td>'+prop.dbfile+'</td>' +
+ '<td>'+prop.server+'</td>' +
+ '<td>'+prop.type+'</td>' +
+ '<td>'+prop.vpn+'</td>' +
+ '<td class="btn-'+ ((localds[i]==connected)?'success':'secondary')+'"></td>'+
+ '</tr>';
+ $("#tbl_datasets").append(row);
+
+ //$("#globaldatasets").append('<option value="'+ds[i]+'">'+prop.name+'</option>');
+ }
+ $('#tbl_datasets').bootstrapTable({
+ pagination: false,
+ search: false,
+ height: tblh,
+ clickToSelect: true
+ });
}
-function db_new(){
- parent.userapp.loadmodulepage('settings','db',null);
-}
\ No newline at end of file
+// function settings_edit(){
+// var settings_id= getTableSelectionID();
+// if (settings_id){
+// parent.browserapp.loadmodulepage('settings','form_datastore',{"id":settings_id});
+// }
+
+// }
+
+function getTableSelectionID(){
+ var sel = $('#tbl_datasets').bootstrapTable('getSelections');
+ var id = null;
+
+ if (sel){ id=sel[0]._id; }
+ console.log("Selected ID:" + id);
+ return id;
+ }
+
+ function getTableSelectionIDs(){
+ var sel = $('#tbl_datasets').bootstrapTable('getSelections');
+ var ids = [];
+ if (sel){
+ for (var s in sel){
+ ids.push(s._id);
+ }
+ }
+ return ids;
+ }
+
+
\ No newline at end of file
--- /dev/null
+var datastore = {
+ new: function(){
+ parent.browserapp.loadmodulepage('settings','form_datastore',{"id":""});
+ },
+ edit: function(){
+ var settings_id= getTableSelectionID();
+ console.log(settings_id);
+ if (settings_id){
+ parent.browserapp.loadmodulepage('settings','form_datastore',{"id":settings_id});
+ }
+ },
+ delete: function(){
+
+ },
+ import: function(){
+
+ },
+ export: function(){
+
+ },
+ test: function(){
+
+ },
+ save: function(){
+ var dts ={};
+ $("input,select").each(function(){
+ var inp = $(this);
+ //console.log(inp);
+ dts[inp.attr("id")] = inp.val();
+ });
+ console.log(dts);
+ console.log(mpref);
+ if (mpref.cfg.id == ""){
+ var keyname = dts['name'].toLowerCase();
+ console.log(keyname);
+ keyname = keyname.replace(/[^a-z0-9-_]/g,"");
+ console.log(keyname);
+ mpref.cfg.id = "db."+ keyname;
+ }
+ if (dts.name){
+ console.log("Before save:" + mpref.cfg.id);
+ parent.usersystem.setPreference(mpref.cfg.id,dts);
+ }
+
+ }
+}
\ No newline at end of file
+++ /dev/null
-<!DOCTYPE html>
-
-<html lang="fr">
-<head>
- <meta charset="utf-8">
-
- <title>Employé(e)</title>
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <meta http-equiv="cache-control" content="max-age=0" />
- <meta http-equiv="cache-control" content="no-cache" />
- <meta http-equiv="expires" content="0" />
- <meta http-equiv="expires" content="Tue, 01 Jan 1970 1:00:00 GMT" />
- <meta http-equiv="pragma" content="no-cache" />
- <link href="../../web/css/bootstrap.min.css" rel="stylesheet" type="text/css">
- <!--<link href="../../web/css/bootstrap-theme.min.css" rel="stylesheet" type="text/css">-->
- <link href="../../web/css/datatables.min.css" rel="stylesheet" type="text/css">
- <link href="../../web/css/dataTables.bootstrap.min.css" rel="stylesheet" type="text/css">
- <link href="../../web/css/bootstrap-datetimepicker.min.css" rel="stylesheet" type="text/css">
- <!-- <link href="../../web/css/bootstrap-timepicker.min.css" rel="stylesheet" type="text/css"> -->
- <link href="../../web/css/glyphicons.css" rel="stylesheet" type="text/css">
- <link href="../../web/css/jquery.minicolors.css" rel="stylesheet" type="text/css">
- <link href="../../web/css/creorga.css" rel="stylesheet" type="text/css">
-</head>
-
-<body>
-
- <div class="container-fluid">
- <br/>
- <!--<span class="pagehead" id="pagehead">Collaborateur</span> -->
- <input type="hidden" value="" id="staff_uuid">
- <table style="width: 100%;">
- <tbody>
- <tr>
- <td style="width: 50%">
- <form>
- <div class="field form-inline">
- <label for="staff_surname">Nom / Prénom</label>
- <input type="text" value="" id="staff_surname" class="form-control">
- <input type="text" value="" id="staff_prename" class="form-control">
- </div>
-
- <div class="field">
- <label for="staff_address">Adresse</label> <input type="text" value="" id="staff_address" class="form-control">
- </div>
-
- <div class="field form-inline">
- <label for="staff_zip">CP / Ville</label>
- <input type="text" value="" size="5" id="staff_zip" class="form-control">
- <input type="text" value="" id="staff_city" class="form-control">
- </div>
-
- <div class="field">
- <label for="staff_country">Pays</label> <input type="text" value="" id="staff_country" class="form-control">
- </div>
- <div class="field form-inline">
- <label for="staff_phone">Tel / E-Mail</label>
- <input type="text" value="" id="staff_phone" class="form-control">
- <input type="text" value="" id="staff_email" class="form-control">
- </div>
- </form>
-
- </td>
-
- <td style="width: 50%;">
- <form>
- <div class="field form-inline" id="date-container">
- <label for="staff_entrydate" style="width: 200px;">Date d'entrée / de sortie</label>
- <div id="dt_staff_entrydate" class="input-group date">
- <input type="date" class="form-control" value="" limits="0" placeholder="dd.mm.yyyy" id="staff_entrydate"><span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
- </div>
-
- <div id="dt_staff_exitdate" class="input-group date">
- <input type="date" class="form-control" value="" limits="0" placeholder="dd.mm.yyyy" id="staff_exitdate"><span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
- </div>
- </div>
-
- <div class="field">
- <label for="staff_jobtitle">Position / Contrat</label> <input type="text" value="" id="staff_jobtitle" class="form-control">
- </div>
- <table style="width: 100%;">
- <tr><td style="width: 40%;"><div class="field">
- <label for="staff_weekhours">heures/semaine</label>
- <div class="input-group number">
- <input type="number" value="" id="staff_weekhours" style="text-align: right;" class="form-control">
-
- <div class="input-group-addon">h</div>
- </div>
- </div></td><td style="width: 40%;"><div class="field">
- <label for="staff_maxdayhours">heures/jour</label>
- <div class="input-group number">
- <input type="number" value="" id="staff_maxdayhours" style="text-align: right;" class="form-control">
-
- <div class="input-group-addon">h</div>
- </div>
- </div></td><td style="width:20%"><div class="field" >
- <label for="staff_color">Couleur</label>
- <div class="input-group">
- <input type="hidden" id="staff_color" class="form-control " value="">
- </div>
- </div></td></tr>
- </table>
- <div class="field">
- <label for="staff_iban">Compte Bancaire</label> <input type="text" value="" id="staff_iban" class="form-control">
- </div>
- <div class="field" id="pwddata">
- <label for="staff_password">Mot de Passe</label>
- <div class="input-group">
- <input type="password" value="" id="staff_password" class="form-control">
- <div class="input-group-addon">(Min: 4 charatères)</div>
- </div>
- </div>
-
- </form>
-
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- <div class="tabbable">
- <ul class="nav nav-tabs" id="tabgrouphead">
- <li><a data-toggle="tab" href="#activity">Organisation interne</a></li>
- <li><a data-toggle="tab" href="#vacancy">Congé</a></li>
- </ul>
-
- <div class="tab-content">
-
- <div id="activity" class="tab-pane">
- <div class="form-group form-inline">
- <label for="year_organisation">Année:</label>
- <div class="input-group">
- <select id="year_organisation" class="selyear">
-
- </select>
- </div>
- <button onclick="dlg_event({'uuid':''},'ins');" class="btn btn-primary" type="button"><span class="glyphicon glyphicon-plus" aria-hidden="true"></span> Activité</button>
- </div>
- <table id="tbl_activity" class="table table-striped">
-
- </table>
- </div>
- <div id="vacancy" class="tab-pane">
- <div class="form-group form-inline">
- <label for="year_vacancy">Année:</label>
- <div class="input-group">
- <select id="year_vacancy" class="selyear">
-
- </select>
- </div>
- <button onclick="dlg_vacancy({'uuid':''},'ins');" class="btn btn-primary" type="button"><span class="glyphicon glyphicon-plus" aria-hidden="true"></span> Congé</button>
- <div class="form-group">
- <label for="vacancy_total">congé normale</label>
-
- <div class="input-group" style="width: 120px;">
- <input type="text" id="vacancyyeartotal" class="form-control" value="" onblur="saveyearvacdays();">
- <span class="input-group-addon">h</span>
- </div>
-
- </div>
- <!--<div class="form-group">
- <label for="vacancylastyearrest">congé à récupérer</label>
-
- <div class="input-group" style="width: 120px;">
- <input type="text" id="vacancylastyearrest" class="form-control" value="0" readonly="1">
- <span class="input-group-addon">h</span>
- </div>
-
- </div>-->
- </div>
-
- <table id="tbl_vacancy" class="table table-striped">
-
- </table>
-
-
- <div id="vacancystatus" style=" white-space: nowrap; width: 100%; text-align: center;"></div>
-
- </div>
- </div>
- </div>
-<!-- EVENT DLG begin -->
-<div class="modal fade" id="edit_event">
- <div class="modal-dialog" style="width: 800px; max-width: 800px;">
- <div class="modal-content">
- <div class="modal-header">
- <button data-dismiss="modal" class="close" type="button"><span aria-hidden="true">x</span><span class="sr-only">Close</span></button>
- <h4 class="modal-title">Editer Activité</h4>
- </div>
- <div class="modal-body" style=" height: 550px; max-height: 550px ">
-<div id="frmeditevent">
- <input type="hidden" value="0" id="uuid" />
- <input type="hidden" value="" id="staffuuid" />
- <input type="hidden" value="" id="description" />
- <input type="hidden" value="" id="color" />
- <input type="hidden" value="" id="location" />
- <div class="form-inline row">
- <label for="staffname" class="col-md-2">Employé(e)</label>
- <input value="" id="staffname" readonly class="form-control col-md-8" style="width: 80%;" ></select>
- </div>
- <div class="row">
- <div class="form-inline">
- <div id="date-container">
- <label class="col-md-3">Dates début / fin</label>
- <div id="dt_datefrom" class="input-group date">
- <input type="date" class="form-control" value="" limits="1" placeholder="dd.mm.yyyy" id="datefrom"><span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
- </div>
- <div id="dt_dateto" class="input-group date">
- <input type="date" class="form-control" value="" limits="1" placeholder="dd.mm.yyyy" id="dateto"><span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
- </div>
- </div>
- </div>
- </div>
- <div class="row">
- <div class="form-inline ">
- <label class="col-md-3">heures début / fin</label>
- <div class="input-group bootstrap-timepicker time">
- <input type="text" class="form-control timepicker" placeholder="" value="" id="timefrom">
- </div>
- <div class="input-group bootstrap-timepicker time">
- <input type="text" class="form-control timepicker" placeholder="" value="" id="timeto">
- </div>
- </div>
- </div>
- <div class="row">
-
- </div>
- <div class="row">
- <div class="panel panel-default">
- <div class="panel-heading">
- <h3 class="panel-title">Récurrence
- <select id="freq" onchange="setfreq();">
- <option value="">pas de récurrence</option>
- <option value="daily">quotidienne</option>
- <option value="weekly">hebdomaire</option>
- <option value="monthly">mensuelle</option>
- </select>
- </h3>
- </div>
- <div class="panel-body">
- <div class="row">
- <div class="form-inline" id="freqinterval">
- <label>interval: tous les</label>
- <input class="form-control" type="number" id="interval" style="width: 50px;" value="1"/>
- <label id="lblfreq"></label>
- </div>
- </div>
- <div class="row" id="freqweekly">
- <div class="form-inline">
- <label>jours de semaine:</label>
- <!--<input class="col-md-2 form-control" style="width: 50px;" type="number" id="xtimes_num" value="1"/>-->
- <!--<label class="col-md-2">semaines,le </label>-->
- <div class="btn-group form-inline" id="weekly_byday" data-toggle="buttons">
- <label class="btn btn-primary">
- <input type="checkbox" id="weekly_byday_mo" value="MO" /> Lundi
- </label>
- <label class="btn btn-primary">
- <input type="checkbox" id="weekly_byday_tu" value="TU" /> Mardi
- </label>
- <label class="btn btn-primary">
- <input type="checkbox" id="weekly_byday_we" value="WE" /> Mercredi
- </label>
- <label class="btn btn-primary">
- <input type="checkbox" id="weekly_byday_th" value="TH" /> Jeudi
- </label>
- <label class="btn btn-primary">
- <input type="checkbox" id="weekly_byday_fr" value="FR" /> Vendredi
- </label>
- <label class="btn btn-primary">
- <input type="checkbox" id="weekly_byday_sa" value="SA" /> Samedi
- </label>
- <!--<label class="btn btn-primary">-->
- <!-- <input type="checkbox" id="weekly_byday_su" value="SU" /> Di-->
- <!--</label>-->
- </div>
- </div>
- </div>
- <div class="row" id="freqmonthly">
- <div class="form-inline">
- <div class="btn-group" data-toggle="buttons" id="monthly_by">
- <label class="btn btn-primary active">
- <input type="radio" id="pnl_monthly_byday" value="monthly_byday" checked="1"/> par jour de semaine
- </label>
- <label class="btn btn-primary">
- <input type="radio" id="pnl_monthly_bymonthday" value="monthly_bymonthday"/> par jour du mois
- </label>
- </div>
- </div>
- <div class="form-inline" id="freq_monthly_byday">
- <!--<label class="col-md-2">tous les</label>-->
- <!--<input class="col-md-2 form-control" type="number" id="xtimes_num" style="width: 50px;" value="1"/>-->
- <!--<label class="col-formmd-2">mois, le </label><br/>-->
- <div class="btn-group" data-toggle="buttons" id="monthly_bydaypos">
- <label class="btn btn-primary">
- <input type="checkbox" id="monthly_bydaypos_1" value="1" /> 1ier
- </label>
- <label class="btn btn-primary">
- <input type="checkbox" id="monthly_bydaypos_2" value="2" /> 2ième
- </label>
- <label class="btn btn-primary">
- <input type="checkbox" id="monthly_bydaypos_3" value="3" /> 3ième
- </label>
- <label class="btn btn-primary">
- <input type="checkbox" id="monthly_bydaypos_4" value="4" /> 4ième
- </label>
- <label class="btn btn-primary">
- <input type="checkbox" id="monthly_bydaypos_5" value="5" /> 5ième
- </label>
- <label class="btn btn-primary">
- <input type="checkbox" id="monthly_bydayppos_last-1" value="-1" /> dernier
- </label>
- </div>
- <br/>
- <div class="btn-group" data-toggle="buttons" id="monthly_bydaywday">
- <label class="btn btn-primary">
- <input type="checkbox" id="monthly_bydaywday_mo" value="MO" /> Lundi
- </label>
- <label class="btn btn-primary">
- <input type="checkbox" id="monthly_bydaywday_tu" value="TU" /> Mardi
- </label>
- <label class="btn btn-primary">
- <input type="checkbox" id="monthly_bydaywday_we" value="WE" /> Merecredi
- </label>
- <label class="btn btn-primary">
- <input type="checkbox" id="monthly_bydaywday_th" value="TH" /> Jeudi
- </label>
- <label class="btn btn-primary">
- <input type="checkbox" id="monthly_bydaywday_fr" value="FR" /> Vendredi
- </label>
- <label class="btn btn-primary">
- <input type="checkbox" id="monthly_bydaywday_sa" value="SA" /> Samedi
- </label>
- <!--<label class="btn btn-primary">-->
- <!-- <input type="checkbox" id="monthly_bydaywday_su" value="SU" /> Di-->
- <!--</label>-->
- </div>
- </div>
- <div class="form-inline" id="freq_monthly_bymonthday">
- <div class="btn-group" data-toggle="buttons" id="monthly_bymonthday">
- <label class="btn btn-primary" style="width: 40px; border-radius: 0px;">
- <input type="checkbox" id="monthly_bymonthday_1" value="1" />1
- </label>
- <label class="btn btn-primary" style="width: 40px;">
- <input type="checkbox" id="monthly_bymonthday_2" value="2" />2
- </label>
- <label class="btn btn-primary" style="width: 40px;">
- <input type="checkbox" id="monthly_bymonthday_3" value="3" />3
- </label>
- <label class="btn btn-primary" style="width: 40px;">
- <input type="checkbox" id="monthly_bymonthday_4" value="4" />4
- </label>
- <label class="btn btn-primary" style="width: 40px;">
- <input type="checkbox" id="monthly_bymonthday_5" value="5" />5
- </label>
- <label class="btn btn-primary" style="width: 40px;">
- <input type="checkbox" id="monthly_bymonthday_6" value="6" />6
- </label>
- <label class="btn btn-primary" style="width: 40px;">
- <input type="checkbox" id="monthly_bymonthday_7" value="7" />7
- </label>
- <br/>
- <label class="btn btn-primary" style="width: 40px;">
- <input type="checkbox" id="monthly_bymonthday_8" value="8" />8
- </label>
- <label class="btn btn-primary" style="width: 40px;">
- <input type="checkbox" id="monthly_bymonthday_9" value="9" />9
- </label>
- <label class="btn btn-primary" style="width: 40px;">
- <input type="checkbox" id="monthly_bymonthday_10" value="10" /> 10
- </label>
- <label class="btn btn-primary" style="width: 40px;">
- <input type="checkbox" id="monthly_bymonthday_11" value="11" /> 11
- </label>
- <label class="btn btn-primary" style="width: 40px;">
- <input type="checkbox" id="monthly_bymonthday_12" value="12" /> 12
- </label>
- <label class="btn btn-primary" style="width: 40px;">
- <input type="checkbox" id="monthly_bymonthday_13" value="13" /> 13
- </label>
- <label class="btn btn-primary" style="width: 40px;">
- <input type="checkbox" id="monthly_bymonthday_14" value="14" /> 14
- </label>
-
- <br/>
-
- <label class="btn btn-primary" style="width: 40px;">
- <input type="checkbox" id="monthly_bymonthday_15" value="15" /> 15
- </label>
- <label class="btn btn-primary" style="width: 40px;">
- <input type="checkbox" id="monthly_bymonthday_16" value="16" /> 16
- </label>
- <label class="btn btn-primary" style="width: 40px;">
- <input type="checkbox" id="monthly_bymonthday_17" value="17" /> 17
- </label>
- <label class="btn btn-primary" style="width: 40px;">
- <input type="checkbox" id="monthly_bymonthday_18" value="18" /> 18
- </label>
- <label class="btn btn-primary" style="width: 40px;">
- <input type="checkbox" id="monthly_bymonthday_19" value="19" /> 19
- </label>
- <label class="btn btn-primary" style="width: 40px;">
- <input type="checkbox" id="monthly_bymonthday_20" value="20" /> 20
- </label>
- <label class="btn btn-primary" style="width: 40px;">
- <input type="checkbox" id="monthly_bymonthday_21" value="21" /> 21
- </label>
-
- <br/>
-
- <label class="btn btn-primary" style="width: 40px;">
- <input type="checkbox" id="monthly_bymonthday_22" value="22" /> 22
- </label>
- <label class="btn btn-primary" style="width: 40px;">
- <input type="checkbox" id="monthly_bymonthday_23" value="23" /> 23
- </label>
- <label class="btn btn-primary" style="width: 40px;">
- <input type="checkbox" id="monthly_bymonthday_24" value="24" /> 24
- </label>
- <label class="btn btn-primary" style="width: 40px;">
- <input type="checkbox" id="monthly_bymonthday_25" value="25" /> 25
- </label>
- <label class="btn btn-primary" style="width: 40px;">
- <input type="checkbox" id="monthly_bymonthday_26" value="26" /> 26
- </label>
- <label class="btn btn-primary" style="width: 40px;">
- <input type="checkbox" id="monthly_bymonthday_27" value="27" /> 27
- </label>
- <label class="btn btn-primary" style="width: 40px;">
- <input type="checkbox" id="monthly_bymonthday_28" value="28" /> 28
- </label>
-
- <br/>
-
- <label class="btn btn-primary" style="width: 40px;">
- <input type="checkbox" id="monthly_bymonthday_29" value="29" /> 29
- </label>
- <label class="btn btn-primary" style="width: 40px;">
- <input type="checkbox" id="monthly_bymonthday_31" value="31" /> 30
- </label>
- <label class="btn btn-primary" style="width: 40px;">
- <input type="checkbox" id="monthly_bymonthday_31" value="31" /> 31
- </label>
- <label class="btn btn-primary" style="width: 157px;" >
- <input type="checkbox" id="monthly_bymonthday_-1" value="-1" /> dernier
- </label>
-
- <br/>
- <label class="btn btn-primary" style="width: 138px;">
- <input type="checkbox" id="monthly_bymonthday_-2" value="-2" /> av.-dernier
- </label>
- <label class="btn btn-primary" style="width: 138px; border-radius: 0px;">
- <input type="checkbox" id="monthly_bymonthday_-3" value="-3" /> av.-av.-dernier
- </label>
- </div>
-
- </div>
-
-
-
- <br/>
-
- </div>
- </div>
-
- </div>
- </div>
-</div>
- </div>
- <div class="modal-footer">
- <button aria-hidden="true" data-dismiss="modal" id="btndeleteevent" onclick="confirm_delete_event();" class="btn">Supprimer</button>
- <button aria-hidden="true" data-dismiss="modal" class="btn">Annuler</button> <button onclick="save_event();" id="btn_save_event" class="btn btn-primary">Accepter</button>
- </div>
- </div>
- </div>
- </div>
- <div class="modal fade" id="confirm_delete_event">
- <div class="modal-dialog">
- <div class="modal-content">
- <div class="modal-header">
- <button data-dismiss="modal" class="close" type="button"><span aria-hidden="true">x</span><span class="sr-only">Close</span></button>
-
- <h4 class="modal-title">Supprimer Activité</h4>
- </div><!-- dialog contents -->
-
- <div class="modal-body">
- Êtes vous sûre de supprimer cette Activité?<br>
-
- </div><!-- dialog buttons -->
-
- <div class="modal-footer">
- <button aria-hidden="true" data-dismiss="modal" class="btn">Non</button> <button onclick="delete_event();" class="btn btn-primary">Oui</button>
- </div>
- </div>
- </div>
- </div>
-<!-- EVENT DLG end -->
- <div class="modal fade" id="edit_vacancy">
- <div class="modal-dialog" style="width: 800px; max-width: 800px;">
- <div class="modal-content">
- <div class="modal-header">
- <button data-dismiss="modal" class="close" type="button"><span aria-hidden="true">x</span><span class="sr-only">Close</span></button>
- <h4 class="modal-title">Editer Congé</h4>
- </div>
- <div class="modal-body" style="height: 410px; max-height: 410px; ">
-<div id="frmeditvacancy">
- <input type="hidden" value="0" id="uuid" />
- <input type="hidden" value="" id="staffuuid" />
- <!--<div class="form-inline row">-->
- <!-- <label for="location" class="col-md-2">Lieu</label>-->
- <!-- <input type="text" value="" id="location" nullable="true" class="form-control col-md-8" style="width: 80%;">-->
- <!--</div>-->
-
- <div class="form-inline row">
- <label for="dailyduration" class="col-md-3">Journée</label>
- <select value="" id="dailyduration" class="form-control" onchange="setdailydurationfields();">
- <option value="1.0">Journée(s) complet(s)</option>
- <option value="0.4">demi(s) Journée(s)</option>
- <option value="0.">quelques heures</option>
- </select>
- </div>
-
- <div class="row form-inline">
- <label class="col-md-3">Date début</label>
- <div id="dt_vacdatefrom" class="input-group date">
- <input type="date" class="form-control" value="" limits="1" placeholder="dd.mm.yyyy" id="vacdatefrom"><span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
- </div>
- </div>
- <div class="row form-inline">
- <label class="col-md-3">Date fin</label>
- <div id="dt_vacdateto" class="input-group date">
- <input type="date" class="form-control" value="" limits="1" placeholder="dd.mm.yyyy" id="vacdateto"><span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
- </div>
- </div>
-
- <div id="ftimefrom" class="row form-inline">
-
- <label class="col-md-3">heure début</label>
- <div class="input-group bootstrap-timepicker time">
- <input type="text" class="form-control timepicker" placeholder="" value="" id="timefrom">
- </div>
- </div>
- <div class="form-inline row" id="fhours">
- <label for="description" class="col-md-3">nbr. d'heures</label>
- <input type="text" value="" id="hours" nullable="true" class="form-control col-md-6" style="width: 20%;">
-
- </div>
-
- <div class="form-inline row">
- <label for="type" class="col-md-3">Type de congé</label>
- <select id="type" value="">
- <option value="0">Congé normal</option>
- <option value="1">Congé expetionelle</option>
- <option value="-1">Congé de maladie</option>
- </select>
- </div>
- <div class="form-inline row">
- <label for="description" class="col-md-3">Description</label>
- <input type="text" value="" id="description" nullable="true" class="form-control col-md-6" style="width: 70%;">
-
- </div>
- <div class="row" style="height: 120px;"></div>
- </div>
- </div>
- <div class="modal-footer">
- <button aria-hidden="true" onclick="accept_vacancy();" data-dismiss="modal" id="btnacceptvacancy" class="btn">Valider Congé</button>
- <button aria-hidden="true" data-dismiss="modal" class="btn">Annuler</button>
- <button onclick="save_vacancy();" class="btn btn-primary">Accepter</button>
- </div>
- </div>
- </div>
- </div>
- <div class="modal fade" id="confirm_delete_vacancy">
- <div class="modal-dialog">
- <div class="modal-content">
- <div class="modal-header">
- <button data-dismiss="modal" class="close" type="button"><span aria-hidden="true">x</span><span class="sr-only">Close</span></button>
-
- <h4 class="modal-title">Supprimer Congé</h4>
- </div><!-- dialog contents -->
-
- <div class="modal-body">
- Êtes vous sûre de supprimer ce congé?<br>
-
- </div><!-- dialog buttons -->
-
- <div class="modal-footer">
- <button aria-hidden="true" data-dismiss="modal" class="btn">Non</button> <button onclick="delete_vacancy();" class="btn btn-primary">Oui</button>
- </div>
- </div>
- </div>
-
-
- </div>
- <script src="../../web/js/jquery.min.js" type="text/javascript"></script>
- <script src="../../web/js/bootstrap.min.js" type="text/javascript"></script>
- <script src="../../web/js/datatables.min.js" type="text/javascript"></script>
- <script src="../../web/js/moment-with-locales.js" type="text/javascript"></script>
- <script src="../../web/js/bootstrap-datetimepicker.min.js" type="text/javascript"></script>
- <script src="../../web/js/jquery.minicolors.min.js" type="text/javascript"></script>
- <script src="../calendar/js/rrule.js" type="text/javascript"></script>
- <script src="../calendar/js/nlp.js" type="text/javascript"></script>
- <script src="chrome://creorga/content/js/encrypt.js" type="text/javascript"></script>
- <script src="chrome://creorga/content/js/navigation.js" type="text/javascript"></script>
- <script src="chrome://creorga/content/js/preferences.js" type="text/javascript"></script>
- <script src="chrome://creorga/content/js/database.js" type="text/javascript"></script>
- <script src="chrome://creorga/content/js/system.js" type="text/javascript"></script>
- <script src="../../web/js/creorga.js" type="text/javascript"></script>
- <script src="../../web/js/labels.js" type="text/javascript"></script>
- <script src="js/coworker.js" type="text/javascript"></script>
-</body>
-</html>
+++ /dev/null
-<!DOCTYPE html>
-
-<html lang="fr">
-<head>
- <meta charset="utf-8">
-
- <title>Employé(e)</title>
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <meta http-equiv="cache-control" content="max-age=0" />
- <meta http-equiv="cache-control" content="no-cache" />
- <meta http-equiv="expires" content="0" />
- <meta http-equiv="expires" content="Tue, 01 Jan 1970 1:00:00 GMT" />
- <meta http-equiv="pragma" content="no-cache" />
- <link href="../../web/css/bootstrap.min.css" rel="stylesheet" type="text/css">
- <!--<link href="../../web/css/bootstrap-theme.min.css" rel="stylesheet" type="text/css">-->
- <link href="../../web/css/datatables.min.css" rel="stylesheet" type="text/css">
- <link href="../../web/css/dataTables.bootstrap.min.css" rel="stylesheet" type="text/css">
- <link href="../../web/css/bootstrap-datetimepicker.min.css" rel="stylesheet" type="text/css">
- <link href="../../web/css/bootstrap-timepicker.min.css" rel="stylesheet" type="text/css">
- <link href="../../web/css/glyphicons.css" rel="stylesheet" type="text/css">
- <link href="../../web/css/jquery.minicolors.css" rel="stylesheet" type="text/css">
- <link href="../../web/css/creorga.css" rel="stylesheet" type="text/css">
-</head>
-
-<body>
-
- <div class="container-fluid">
- <br/>
- <!--<span class="pagehead" id="pagehead">Collaborateur</span> -->
- <input type="hidden" value="" id="staff_uuid">
- <table style="width: 100%;">
- <tbody>
- <tr>
- <td style="width: 50%">
- <form>
- <div class="field form-inline">
- <label for="staff_surname">Nom / Prénom</label>
- <input type="text" value="" id="staff_surname" class="form-control">
- <input type="text" value="" id="staff_prename" class="form-control">
- </div>
-
- <div class="field">
- <label for="staff_address">Adresse</label> <input type="text" value="" id="staff_address" class="form-control">
- </div>
-
- <div class="field form-inline">
- <label for="staff_zip">CP / Ville</label>
- <input type="text" value="" size="5" id="staff_zip" class="form-control">
- <input type="text" value="" id="staff_city" class="form-control">
- </div>
-
- <div class="field">
- <label for="staff_country">Pays</label> <input type="text" value="" id="staff_country" class="form-control">
- </div>
- <div class="field form-inline">
- <label for="staff_phone">Tel / E-Mail</label>
- <input type="text" value="" id="staff_phone" class="form-control">
- <input type="text" value="" id="staff_email" class="form-control">
- </div>
- </form>
-
- </td>
-
- <td style="width: 50%;">
- <form>
- <div class="field form-inline" id="date-container">
- <label for="staff_entrydate" style="width: 200px;">Date d'entrée / de sortie</label>
- <div id="dt_staff_entrydate" class="input-group date">
- <input type="date" class="form-control" value="" limits="0" placeholder="dd.mm.yyyy" id="staff_entrydate" readonly="1"><span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
- </div>
-
- <div id="dt_staff_exitdate" class="input-group date">
- <input type="date" class="form-control" value="" limits="0" placeholder="dd.mm.yyyy" id="staff_exitdate" readonly="1"><span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
- </div>
- </div>
-
- <div class="field">
- <label for="staff_jobtitle">Position / Contrat</label> <input type="text" value="" id="staff_jobtitle" readonly="1" class="form-control">
- </div>
- <table style="width: 100%;">
- <tr><td style="width: 50%;"><div class="field">
- <label for="staff_weekhours">heures/semaine</label>
- <div class="input-group number">
- <input type="number" value="" id="staff_weekhours" style="text-align: right;" class="form-control" readonly="1">
-
- <div class="input-group-addon">h</div>
- </div>
- </div></td><td style="width:50%"><div class="field" >
- <label for="staff_color">Couleur</label>
- <div class="input-group">
- <input type="text" id="staff_color" class="form-control" value="" readonly="1">
- </div>
- </div></td></tr>
- </table>
- <div class="field">
- <label for="staff_iban">Compte Bancaire</label> <input type="text" value="" id="staff_iban" class="form-control">
- </div>
- <div class="field" id="pwddata">
- <label for="staff_password">Mot de Passe</label>
- <div class="input-group">
- <input type="password" value="" id="staff_password" class="form-control">
- <div class="input-group-addon">(Min: 4 charatères)</div>
- </div>
- </div>
-
- </form>
-
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- <div class="tabbable">
- <ul class="nav nav-tabs" id="tabgrouphead">
- <li><a data-toggle="tab" href="#activity">Organisation interne</a></li>
- <li><a data-toggle="tab" href="#vacancy">Congé</a></li>
- </ul>
-
- <div class="tab-content">
-
- <div id="activity" class="tab-pane">
- <div class="form-group form-inline">
- <label for="year_organisation">Année:</label>
- <div class="input-group">
- <select id="year_organisation" class="selyear">
-
- </select>
- </div>
-
- </div>
- <table id="tbl_activity" class="table table-striped">
-
- </table>
- </div>
- <div id="vacancy" class="tab-pane">
- <div class="form-group form-inline">
- <label for="year_vacancy">Année:</label>
- <div class="input-group">
- <select id="year_vacancy" class="selyear">
-
- </select>
- </div>
- <button onclick="dlg_vacancy({'uuid':''},'ins');" class="btn btn-primary" type="button"><span class="glyphicon glyphicon-plus" aria-hidden="true"></span> demande de Congé</button>
- <div class="form-group">
- <label for="vacancy_total">congé normale</label>
-
- <div class="input-group" style="width: 120px;">
- <input type="text" id="vacancyyeartotal" class="form-control" value="" readonly="1">
- <span class="input-group-addon">h</span>
- </div>
-
- </div>
- <div class="form-group">
- <label for="vacancylastyearrest">congé à récupérer</label>
-
- <div class="input-group" style="width: 120px;">
- <input type="text" id="vacancylastyearrest" class="form-control" value="0" readonly="1">
- <span class="input-group-addon">h</span>
- </div>
-
- </div>
-
- </div>
- <table>
- <tr>
- <td style="width: 800px; vertical-align: top;">
- <table id="tbl_vacancy" class="table table-striped">
-
- </table>
- </td>
- <td>
- <table style="width: 100%;" class="table table-striped table-bordered">
- <thead>
- <tr><th colspan="5">Congé <span id="lblyear"></span></th></tr>
- <tr><th> </th><th> </th><th colspan="2">planification</th><th> </th></tr>
- <tr><th>Type</th><th>ouvert</th><th>demandé</th><th>validé</th><th>pris</th></tr>
- </thead>
- <tbody>
- <tr>
- <td>normale</td>
- <td class="alignright" id="vacnopen"> </td>
- <td class="alignright" id="vacnasked"> </td>
- <td class="alignright" id="vacnplanned"> </td>
- <td class="alignright" id="vacntaken"> </td>
- </tr>
- <tr>
- <td>exceptionelle</td>
- <td class="alignright" id="vaceopen"> </td>
- <td class="alignright" id="vaceasked"> </td>
- <td class="alignright" id="vaceplanned"> </td>
- <td class="alignright" id="vacetaken"> </td>
- </tr>
- <tr>
- <td>maladie</td>
- <td class="alignright" id="vacmopen"> </td>
- <td class="alignright" id="vacmasked"> </td>
- <td class="alignright" id="vacmplanned"> </td>
- <td class="alignright" id="vacmtaken"> </td>
- </tr>
- </tbody>
- <tfoot>
- <tr>
- <th>total</th>
- <th class="alignright" id="vactopen"> </th>
- <td class="alignright" id="vactasked"> </td>
- <th class="alignright" id="vactplanned"> </th>
- <th class="alignright" id="vacttaken"> </th>
- </tr>
- </tfoot>
- </table>
- </td>
- </tr>
- </table>
-
- <div id="vacancystatus" style=" white-space: nowrap; width: 100%; text-align: center;"></div>
-
- </div>
- </div>
- </div>
-
- <div class="modal fade" id="edit_vacancy">
- <div class="modal-dialog" style="width: 800px; max-width: 800px;">
- <div class="modal-content">
- <div class="modal-header">
- <button data-dismiss="modal" class="close" type="button"><span aria-hidden="true">x</span><span class="sr-only">Close</span></button>
- <h4 class="modal-title">Editer Congé</h4>
- </div>
- <div class="modal-body" style="height: 410px; max-height: 410px; ">
-<div id="frmeditvacancy">
- <input type="hidden" value="0" id="uuid" />
- <input type="hidden" value="" id="staffuuid" />
-
-
- <div class="form-inline row">
- <label for="dailyduration" class="col-md-3">Journée</label>
- <select value="" id="dailyduration" class="form-control" onchange="setdailydurationfields();">
- <option value="1.0">Journée(s) complet(s)</option>
- <option value="0.4">demi(s) Journée(s)</option>
- <option value="0.">quelques heures</option>
- </select>
- </div>
-
- <div class="row form-inline">
- <label class="col-md-3">Date début</label>
- <div id="dt_vacdatefrom" class="input-group date">
- <input type="date" class="form-control" value="" limits="1" placeholder="dd.mm.yyyy" id="vacdatefrom"><span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
- </div>
- </div>
- <div class="row form-inline">
- <label class="col-md-3">Date fin</label>
- <div id="dt_vacdateto" class="input-group date">
- <input type="date" class="form-control" value="" limits="1" placeholder="dd.mm.yyyy" id="vacdateto"><span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
- </div>
- </div>
-
- <div id="ftimefrom" class="row form-inline">
-
- <label class="col-md-3">heure début</label>
- <div class="input-group bootstrap-timepicker time">
- <input type="text" class="form-control timepicker" placeholder="" value="" id="timefrom">
- </div>
- </div>
- <div class="form-inline row" id="fhours">
- <label for="description" class="col-md-3">nbr. d'heures</label>
- <input type="text" value="" id="hours" nullable="true" class="form-control col-md-6" style="width: 20%;">
-
- </div>
- <div class="form-inline row">
- <label for="type" class="col-md-3">Type de congé</label>
- <select id="type" value="">
- <option value="0">Congé normal</option>
- <option value="1">Congé expetionelle</option>
- <option value="-1">Congé de maladie</option>
- </select>
- </div>
- <div class="form-inline row">
- <label for="description" class="col-md-3">Description</label>
- <input type="text" value="" id="description" nullable="true" class="form-control col-md-6" style="width: 70%;">
-
- </div>
- <div class="row" style="height: 120px;"></div>
- </div>
- </div>
- <div class="modal-footer">
-
- <button aria-hidden="true" data-dismiss="modal" class="btn">Annuler</button>
- <button onclick="save_vacancy();" class="btn btn-primary">Envoyer la demande</button>
- </div>
- </div>
- </div>
- </div>
- <div class="modal fade" id="confirm_delete_vacancy">
- <div class="modal-dialog">
- <div class="modal-content">
- <div class="modal-header">
- <button data-dismiss="modal" class="close" type="button"><span aria-hidden="true">x</span><span class="sr-only">Close</span></button>
-
- <h4 class="modal-title">Supprimer Congé</h4>
- </div><!-- dialog contents -->
-
- <div class="modal-body">
- Êtes vous sûre de supprimer ce congé?<br>
-
- </div><!-- dialog buttons -->
-
- <div class="modal-footer">
- <button aria-hidden="true" data-dismiss="modal" class="btn">Non</button> <button onclick="delete_vacancy();" class="btn btn-primary">Oui</button>
- </div>
- </div>
- </div>
-
-
- </div>
- <script src="../../web/js/jquery.min.js" type="text/javascript"></script>
- <script src="../../web/js/bootstrap.min.js" type="text/javascript"></script>
- <script src="../../web/js/datatables.min.js" type="text/javascript"></script>
- <script src="../../web/js/moment-with-locales.js" type="text/javascript"></script>
- <script src="../../web/js/bootstrap-datetimepicker.min.js" type="text/javascript"></script>
- <!-- <script src="../../web/js/bootstrap-timepicker.min.js" type="text/javascript"></script> -->
- <script src="../../web/js/bootstrap-multiselect.js" type="text/javascript"></script>
- <script src="../calendar/js/rrule.js" type="text/javascript"></script>
- <script src="../calendar/js/nlp.js" type="text/javascript"></script>
- <script src="chrome://creorga/content/js/encrypt.js" type="text/javascript"></script>
- <script src="chrome://creorga/content/js/navigation.js" type="text/javascript"></script>
- <script src="chrome://creorga/content/js/preferences.js" type="text/javascript"></script>
- <script src="chrome://creorga/content/js/database.js" type="text/javascript"></script>
- <script src="chrome://creorga/content/js/system.js" type="text/javascript"></script>
- <script src="../../web/js/creorga.js" type="text/javascript"></script>
- <script src="../../web/js/labels.js" type="text/javascript"></script>
- <script src="js/coworker_basic.js" type="text/javascript"></script>
-</body>
-</html>
+++ /dev/null
-//Source-code licensed under EUPL v1.1 ( Copyright 2016 By DKS s.à r.l. - Kilian Saffran - Luxembourg )
-var pconfig = null;
-var delplan = null;
-var delvacation = null;
-var wh= window.innerHeight -440;
-var curdatediff = null;
-var redate = /\d\d.\d\d.\d\d\d\d/;
-var curfreq ={};
-var maxdayhours = null;
-var maxhalfdayhours = null;
-//var lictype = apppref.getpreference("support.lictype");
-
-function initdata() {
- load_helpers();
- var pdata = apppref.getpreference("pageconfig.coworker");
- if (pdata != '') {
- pconfig = JSON.parse(pdata);
- }
- //"get CoWorker cfg:" +JSON.stringify(pconfig) + "\n");
- if (!pconfig.year) {
- pconfig.year=new Date().getFullYear();
- }
- if (!pconfig.printlayout) {
- pconfig.printlayout = 'list';
- apppref.setpreference("pageconfig.coworker",pconfig);
- }
- var cdatasql = "SELECT jobtitle, prename, surname, address, zip, city, country, strftime('%d.%m.%Y',entrydate) as entrydate, strftime('%d.%m.%Y',exitdate) as exitdate, iban, bic, accountname, phone, email, uuid,color,weekhours,maxdayhours,case when password is not null and length(password) > 3 then 1 else 0 end as passwordset FROM staff where uuid='" + pconfig.uuid + "';";
- var cdata = appdb.dbquery(cdatasql);
- cdata = cdata.sqldata[0];
- for (var ci in cdata) {
- if (document.getElementById("staff_" + ci)) {
- document.getElementById("staff_" + ci).setAttribute('value', cdata[ci]);
- }
-
- }
-
- var crdata = appdb.dbquery("select stafflist from creche;");
- if ((crdata) && (crdata.sqldata[0].stafflist == "1")){
- $("#pwddata").hide();
- }
- if (cdata) {
- set_infoheader(cdata.prename + " " + cdata.surname);
- }
- $('#staff_color').minicolors({theme:'bootstrap'});
- set_selectyears();
- //load_staff_selection('staffuuid');
-
- if (pconfig && pconfig.activetab) {
- $('a[href="#'+pconfig.activetab+'"]').tab('show');
- }else{
- $('a[href="#vacancy"]').tab('show');
- pconfig.activetab = 'vacancy';
- }
-
-// if (pconfig && pconfig.vacancyunit){
-// //dump("has vacancy unit:" + pconfig.vacancyunit + "\n");
-// $('#vacancy_unit').val(pconfig.vacancyunit);
-// }else {
- pconfig.vacancyunit = "hours";
-// $('#vacancy_unit').val("days");
-// }
-
- $('#frmeditvacancy #vacdatefrom').on("blur",function (e) {
- var ok = true;
- if ($('#frmeditvacancy #vacdatefrom').val().match(redate)) {
- $('#btn_save_vacancy').removeAttr("disabled");
- }else {
- ok = false;
- $('#btn_save_vacancy').attr("disabled","1");
- }
- if ((ok == true) && ($('#frmeditvacancy #vacdateto').val() != '')) {
- var tmpdt1 = encodeparam($('#frmeditvacancy #vacdatefrom').val(),'date');
- var nd = new Date(tmpdt1.replace(/'/g,''));
- var xd = new Date(nd.getFullYear(),nd.getMonth(),nd.getDate() + curdatediff);
- $('#frmeditvacancy #vacdateto').val(xd.toLocaleFormat("%d.%m.%Y"));
- var tmpdt2 = encodeparam($('#frmeditvacancy #vacdateto').val(),'date');
- if (tmpdt1 > tmpdt2) {
- $('#btn_save_vacancy').attr("disabled","1");
- } else {
- $('#btn_save_vacancy').removeAttr("disabled");
- }
-
- }
- });
- $('#frmeditvacancy #vacdateto').on("blur",function (e) {
- var ok = true;
- if ($('#frmeditvacancy #vacdateto').val().match(redate)) {
- $('#btn_save_vacancy').removeAttr("disabled");
- }else {
- ok = false;
- $('#btn_save_vacancy').attr("disabled","1");
- }
- curdatediff=daysBetween(new Date(encodeparam($('#frmeditvacancy #vacdatefrom').val(),'date').replace(/'/g,'')),new Date(encodeparam($('#frmeditvacancy #vacdateto').val(),'date').replace(/'/g,'')));
- if ((ok == true) && ($('#frmeditvacancy #vacdateto').val() != '')) {
- var tmpdt1 = encodeparam($('#frmeditvacancy #vacdatefrom').val(),'date');
- var tmpdt2 = encodeparam($('#frmeditvacancy #vacdateto').val(),'date');
- if (tmpdt1 > tmpdt2) {
- $('#btn_save_vacancy').attr("disabled","1");
- } else {
- $('#btn_save_vacancy').removeAttr("disabled");
- }
-
- }
- });
- $('#dailyduration').on('change',function(e){
- if ($('#dailyduration').val() == "1.0"){
- $('#frmeditvacancy #hours').val(maxdayhours);
- }
- if ($('#dailyduration').val() == "0.4"){
- $('#frmeditvacancy #hours').val(maxhalfdayhours);
- }
- });
- $('#staff_color').on('change',function(e){
- saveonfocusout('staff_color');
- });
- //$('#frmeditevent #color').minicolors({theme:'bootstrap',position: 'bottom right'});
- $("#weekly_byday :input").change(function() {
- if (this.checked) {
- this.setAttribute("checked",true);
- }else {
- this.removeAttribute("checked");
- }
-
-});
- $("#monthly_bydaypos :input").change(function() {
-
- if (this.checked) {
- this.setAttribute("checked",true);
- }else {
- this.removeAttribute("checked");
- }
-
-});
- $("#monthly_bydaywday :input").change(function() {
-
- if (this.checked) {
- this.setAttribute("checked",true);
- }else {
- this.removeAttribute("checked");
- }
-
-});
- $("#monthly_bymonthday :input").change(function() {
-
- if (this.checked) {
- this.setAttribute("checked",true);
- }else {
- this.removeAttribute("checked");
- }
-
-});
- $("#monthly_by :input").change(function() {
- var xd = this.id.split("_");
- curfreq.freqtype=xd[2];
-
- this.setAttribute("checked",true);
-
- $('#freq_monthly_byday').hide();
- $('#freq_monthly_bymonthday').hide();
- $('#pnl_monthly_byday').removeAttr("checked");
- $('#pnl_monthly_bymonthday').removeAttr("checked");
-
- $('#freq_' + this.value).show();
-
-});
-
- $('#frmeditevent #datefrom').on("blur",function (e) {
- var ok = true;
- if ($('#frmeditevent #datefrom').val().match(redate)) {
- $('#btn_save_event').removeAttr("disabled");
- }else {
- ok = false;
- $('#btn_save_event').attr("disabled","1");
- }
- if ((ok == true) && ($('#frmeditevent #dateto').val() != '')) {
- var tmpdt1 = encodeparam($('#frmeditevent #datefrom').val(),'date');
- var tmpdt2 = encodeparam($('#frmeditevent #dateto').val(),'date');
- if (tmpdt1 >= tmpdt2) {
- $('#btn_save_event').attr("disabled","1");
- } else {
- $('#btn_save_event').removeAttr("disabled");
- }
-
- }
- });
- $('#frmeditevent #dateto').on("blur",function (e) {
- var ok = true;
- if ($('#frmeditevent #dateto').val().match(redate)) {
- $('#btn_save_event').removeAttr("disabled");
- }else {
- ok = false;
- $('#btn_save_event').attr("disabled","1");
- }
- if ((ok == true) && ($('#frmeditevent #dateto').val() != '')) {
- var tmpdt1 = encodeparam($('#frmeditevent #datefrom').val(),'date');
- var tmpdt2 = encodeparam($('#frmeditevent #dateto').val(),'date');
-
- if (tmpdt1 >= tmpdt2) {
- $('#btn_save_event').attr("disabled","1");
- } else {
- $('#btn_save_event').removeAttr("disabled");
- }
-
- }
- });
-
-}
-
-$('.selyear').on( "change", function(e){
- e.preventDefault();
-
- $(".selyear").val($(this).val());
- pconfig.year = $(this).val();
- apppref.setpreference("pageconfig.coworker",pconfig);
- if ($(this).attr('id') == "year_organisation") {
- load_event_data();
- }else if ($(this).attr('id') == "year_vacancy") {
- load_table_vacancy();
- }
-});
-
-$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
- var tn = e.target.toString();
- pconfig.activetab = tn.substring(tn.lastIndexOf("#")+1);
- //dump(JSON.stringify(pconfig) + "\n");
- apppref.setpreference("pageconfig.coworker",pconfig);
- if (pconfig.activetab == 'activity') {
- load_event_data();
- }
- if (pconfig.activetab == 'vacancy') {
- load_table_vacancy();
- }
- });
-
-function load_event_data() {
- dump("Load event Table!\n");
- var where = new Array();
-
- where.push(" st.uuid in ('"+ pconfig.uuid + "')");
-
- $("div.panel-daybody").html("");
- var sql = "SELECT cal.uuid, cal.datefrom, cal.dateto, '<div style=\"display:none;\">' || strftime('%Y%m%d',cal.datefrom) ||'</div>' || strftime('%d.%m.%Y',cal.datefrom) AS tbldatefrom ,strftime('%Y%m%d',cal.datefrom) AS strdatefrom, strftime('%Y%m%d',cal.dateto) AS strdateto,cal.timefrom, cal.timeto, cal.description, cal.location, cal.color, cal.freq, '[\"' || GROUP_CONCAT(sp.staffuuid,'\",\"') || '\"]' as staffuuid, GROUP_CONCAT(coalesce(st.surname,'') || ' ' || coalesce(st.prename,''), '<br/>' ) as staffnames ,'[\"' || GROUP_CONCAT(st.color,'\",\"') || '\"]' as staffcolors from eventcalendar cal " +" join staffplanning sp on (cal.uuid=sp.eventcalendaruuid " + " AND sp.staffuuid in ('"+ pconfig.uuid +"')) left join staff st on (sp.staffuuid=st.uuid) "+
- " where (cal.datefrom between '" + $('#year_organisation').val() + "-01-01' and '" + $('#year_organisation').val() + "-12-31' and (cal.dateto >= '" + $('#year_organisation').val() + "-01-01' or cal.dateto is null)) or (cal.dateto between '" + $('#year_organisation').val() + "-01-01' and '" + $('#year_organisation').val() + "-12-31' and cal.datefrom < '" + $('#year_organisation').val() + "-01-01') or ((cal.datefrom <= '" + $('#year_organisation').val() + "-01-01') and ((cal.dateto >= '" + $('#year_organisation').val() + "-12-31') or cal.dateto is null)) "+ ((where.length > 0)?" AND (" + where.join(" or ") + ")":"")+" group by cal.uuid order by cal.datefrom,cal.dateto;";
-
- var caldata = appdb.dbquery(sql);
-
- caldata = caldata.sqldata;
-
- var headerdata = getlabels("act,datefrom,hours,recurrance");
- $("#tbl_activity").html("");
-
- var hrow = headerdata;
- var tdclass= new Array();
- var tblheader = '<tr>';
-
- for (var h=0;h<hrow.length;h++){
- tdclass.push(headerdata[h].class);
- tblheader += '<th class="' + headerdata[h].class +'">'+ headerdata[h].title+'</th>';
- }
- tblheader += '</tr>';
-
- $("#tbl_activity").append("<thead>" + tblheader + "</thead>");
- $("#tbl_activity").append("<tbody>");
- var tblbody = [];
- for (var c in caldata) {
- var tblrow = "<tr>";
- tblrow += '<td class="noprint"><button type="button" class="btn btn-primary" onclick="dlg_event({uuid:\''+caldata[c].uuid+'\'},\'upd\');" title="editer"><span class="glyphicon glyphicon-pencil"></span></button></td>';
- //tblrow += "<td><span style=\"display: none;\">"+caldata[c].description+"</span><strong style=\"color:"+ caldata[c].color +"\">" + caldata[c].description + "</strong></td>";
- //tblrow += "<td>" + caldata[c].staffnames + "</td>";
- tblrow += "<td>" + caldata[c].tbldatefrom + "</td>";
- tblrow += "<td>" + caldata[c].timefrom + "- " + caldata[c].timeto + "</td>";
-
- var freq2 = caldata[c].freq;
- if (freq2 != '') {
-
- freq2 += ';DTSTART='+caldata[c].strdatefrom + 'T000000Z';
- if (caldata[c].dateto != ''){
- freq2 += ';UNTIL='+caldata[c].strdateto + 'T000000Z';
- }
- }
-
- try {
-
- var rule2 = RRule.fromString(freq2);
-
-
- tblrow += "<td>" + rule2.toText() + "</td>";
-
- } catch (ex){
- //"ERROR! loading data!" + ex + " FREQ:" + freq2 + "\n");
- }
- tblrow += "</tr>";
- tblbody.push(tblrow);
- }
-
- //load table
- $("#tbl_activity").append(tblbody.join(''));
- $("#tbl_activity").append("</tbody>");
-
- tblcal = $("#tbl_activity").dataTable({
- "language": {
- "url": "../../web/js/locale/datatable_fr.json"
- },
- "paging": false,
- "scrollY": wh + "px",
- "scrollCollapse": true,
- "ordering": true,
- "info": false,
- "filter": false,
- "destroy": true
- });
-
- //$('#tbl_activity').on( 'search.dt', function () {
- //
- // pconfig.filter = tblcal.api().search();
- //
- // apppref.setpreference("pageconfig.calactivity",pconfig);
- //} );
-
- //$('#tbl_activity').on( 'order.dt', function () {
- // pconfig.order= tblcal.fnSettings().aaSorting;
- //
- // apppref.setpreference("pageconfig.calactivity",pconfig);
- //
- //} );
-
-// if (pconfig.filter) {
-// tblcal.fnFilter(pconfig.filter);
-// }
- if (pconfig.order) {
- tblcal.fnSort(pconfig.order);
- }
- if (/*(!pconfig.filter) && */ (!pconfig.order)) {
- tblcal.fnDraw();
- }
-}
-
-function load_table_vacancy() {
- //maxdayhours = (parseFloat($("#staff_weekhours").val())/5).toFixed(2);
- //maxhalfdayhours = (maxdayhours/2).toFixed(2);
- var yearvacanysql = "select hours from staffvacancydays where staffuuid='"+ pconfig.uuid+"' and vacancyyear='"+ $("#year_vacancy").val() +"';";
- var yearvac = appdb.dbquery(yearvacanysql);
- var nvyear = "";
- //jsdump("XXSQL:" + JSON.stringify(yearvac) + "\n");
- if (yearvac.sqldata){
- nvyear = yearvac.sqldata[0].hours;
- }
- $("#vacancyyeartotal").val(nvyear);
- var vacdatasql = "SELECT '<button type=\"button\" class=\"btn btn-primary\" onclick=\"dlg_vacancy({''uuid'':'''|| uuid || '''},''upd'');\"><span class=\"glyphicon glyphicon-pencil\"></span></button>" +
- "<button type=\"button\" class=\"btn btn-danger\" onclick=\"confirm_delete_vacancy(''' || uuid || ''');\"><span class=\"glyphicon glyphicon-remove\"></span></button>' AS action," + "vacyear," +
- "strftime('%d.%m.%Y', datefrom) as datefrom,strftime('%d.%m.%Y', dateto) as dateto,printf(\"%.2f\",hours) || 'h' as dayhours,description," +
- "case when type=0 and accepted != '1' then printf(\"%.2f\",case when hours < maxdayhours then hours when hours > maxdayhours then maxdayhours else hours end) || 'h' else '' end as thnormalnv," +
- "case when type=1 and accepted != '1' then printf(\"%.2f\",case when hours < maxdayhours then hours when hours > maxdayhours then maxdayhours else hours end) || 'h' else '' end as thextranv," +
- "case when type=-1 and accepted != '1' then printf(\"%.2f\",case when hours < maxdayhours then hours when hours > maxdayhours then maxdayhours else hours end) || 'h' else '' end as thillnv," +
- "case when type=0 and accepted = '1'then printf(\"%.2f\",case when hours < maxdayhours then hours when hours > maxdayhours then maxdayhours else hours end) || 'h' else '' end as thnormalval," +
- "case when type=1 and accepted = '1' then printf(\"%.2f\",case when hours < maxdayhours then hours when hours > maxdayhours then maxdayhours else hours end) || 'h' else '' end as thextraval," +
- "case when type=-1 and accepted = '1' then printf(\"%.2f\",case when hours < maxdayhours then hours when hours > maxdayhours then maxdayhours else hours end) || 'h' else '' end as thillval," +
- "case when type=0 then 'normal' when type=1 then 'exceptionnelle' when type=-1 then 'maladie' end as vacancytype,case when accepted='1' and type != -1 then '<span style=\"font-weight: bold; color: green;\">OUI</span>' else '<span style=\"font-weight: bold; color: red\">NON</span>' end as accepted FROM (" +
- "select vc.uuid,vc.vacyear,vc.datefrom,vc.dateto,vc.type,vc.description,vc.accepted," +
- "((strftime('%s',vc.dateto) - strftime('%s',vc.datefrom)) /84600) + 1 as days," +
- "((((strftime('%s',vc.dateto) - strftime('%s',vc.datefrom)) /84600) + 1) / 7) * (7 - (st.weekhours / st.maxdayhours)) as day_to_much," +
- "(select count(v.vacancydate) from vacancy v where v.vacancydateto is null and strftime('%s',v.vacancydate) not in ('0','6') and v.vacancydate between vc.datefrom and vc.dateto) as vdays,st.weekhours,st.weekhours / maxdayhours as days_per_week,vc.timefrom,vc.timeto,st.maxdayhours, " +
- "cast(cast(strftime(\"%s\",vc.timeto) as int)- cast(strftime(\"%s\",vc.timefrom) as int) as real)/3600 as hours " +
- "from vacancycalendar vc join staff st on (vc.staffuuid=st.uuid) where vc.staffuuid='"+ pconfig.uuid+"' and vc.vacyear=" + pconfig.year+");";
- // var vacdatasql = "SELECT '<button type=\"button\" class=\"btn btn-primary\" onclick=\"dlg_vacancy({''uuid'':'''|| uuid || '''},''upd'');\"><span class=\"glyphicon glyphicon-pencil\"></span></button> <button type=\"button\" class=\"btn btn-danger\" onclick=\"confirm_delete_vacancy(''' || uuid || ''');\"><span class=\"glyphicon glyphicon-remove\"></span></button>' AS action,vacyear," +
-// "CASE WHEN datefrom!=dateto THEN 'du:' || strftime('%d.%m.%Y', CASE WHEN datefrom < DATE('"+ pconfig.year +"-01-01') THEN DATE('"+ pconfig.year +"-01-01') ELSE datefrom END) || '<br/>au: ' || strftime('%d.%m.%Y', CASE WHEN dateto > DATE('"+ pconfig.year +"-12-31') THEN DATE('"+ pconfig.year +"-12-31') ELSE dateto END) ELSE strftime('%d.%m.%Y',datefrom) END AS planningdaterange," +
-// //"case when datefrom!=dateto then strftime('%d.%m.%Y',case when datefrom < date('"+ pconfig.year +"-01-01') then 'de: ' date('"+ pconfig.year +"-01-01') else datefrom end) || '<br/>à: ' || strftime('%d.%m.%Y',case when dateto > date('"+ pconfig.year +"-12-31') then date('"+ pconfig.year +"-12-31') else dateto end) else strftime('%d.%m.%Y',datefrom) end as planningdaterange, " +
-// "case when timefrom=timeto then '"+ maxdayhours+ "' || 'h' else printf(\"%.2f\",cast(cast(strftime(\"%s\",timeto) as int)- cast(strftime(\"%s\",timefrom) as int) as real)/3600) || 'h' || case when timefrom!='00:00' then '<br/> à partir de ' || timefrom else '' end end as hourrange," +
-// //"case when timefrom=timeto then '8h' when (cast(substr(timeto,1,2) as int) - cast(substr(timefrom,1,2) as int))= 4 then '4h' || case when timefrom!='00:00' then '<br/> à partir de ' || timefrom else '' end else (cast(substr(timeto,1,2) as int) - cast(substr(timefrom,1,2) as int)) || 'h' || case when timefrom!='00:00' then '<br/> à partir de ' || timefrom else '' end end as hourrange, "+
-// "description, " +
-// "case when type=0 then 'normal' when type=1 then 'exceptionnelle' when type=-1 then 'maladie' end as vacancytype,case when accepted='1' and type != -1 then '<span style=\"font-weight: bold; color: green;\">OUI</span>' else '<span style=\"font-weight: bold; color: red\">NON</span>' end as accepted FROM vacancycalendar where staffuuid='"+ pconfig.uuid +"' and (strftime('%Y',dateto)='"+ pconfig.year +"' or strftime('%Y',datefrom)='"+ pconfig.year +"');";
-//jsdump("XXSQL:" + vacdatasql + "\n");
-var vacdata = appdb.dbqueryarray(vacdatasql);
-//jsdump("XXSQL:" + JSON.stringify(vacdata) + "\n");
-
- $('#tbl_vacancy').html("");
- //$('#tbl_vacancy').append('<tfoot><tr><th></th><th colspan="4" style="text-align: center;"></th></tr></tfoot>');
- //getlastyearsrest();
- //calcvacancy();
- //vacdata.sqlhead.join(",") + "\n");
- var headerdata = getlabels(vacdata.sqlhead.join(","));
-
-
- $("#tbl_vacancy").dataTable({
- "language": {
- "url": "../../web/js/locale/datatable_fr.json"
- },
- "data": vacdata.sqldata,
- "columns": headerdata,
- "paging": false,
- "scrollY": wh + "px",
- "scrollCollapse": true,
- "ordering": true,
- "info": false,
- "filter": false,
- "destroy": true
- });
-
-}
-
-function dlg_vacancy(uuid, type) {
- //select weekhours/5 = max daily hours
- maxdayhours = (parseFloat($("#staff_weekhours").val())/5).toFixed(2);
- maxhalfdayhours = (maxdayhours/2).toFixed(2);
- var evdata = {
- uuid: 0,
- description: '',
- vacdatefrom:new Date().toLocaleFormat("%d.%m.%Y"),
- vacdateto:new Date().toLocaleFormat("%d.%m.%Y"),
- staffuuid:[pconfig.uuid],
- timefrom: '00:00',
- hours: maxdayhours,
- type:'0',
- //dailyduration:'1.0',
- //hourmax: whr
- };
-
- if (type == 'upd') {
- var evsql = "select uuid,vacdatefrom,vacdateto,timefrom,description,staffuuid,case when hours = '0.00' then '" + maxdayhours +"' else hours end as hours,accepted from (SELECT uuid, strftime(\"%d.%m.%Y\",datefrom) as vacdatefrom, strftime(\"%d.%m.%Y\",dateto) as vacdateto, timefrom, description, '"+pconfig.uuid+"' as staffuuid,type, printf(\"%.2f\",cast((cast(strftime(\"%s\",timeto) as int)- cast(strftime(\"%s\",timefrom) as int))/3600 as real)) as hours,accepted FROM vacancycalendar where uuid='" + uuid.uuid + "');";
- //var evsql = "SELECT uuid, strftime(\"%d.%m.%Y\",datefrom) as vacdatefrom, strftime(\"%d.%m.%Y\",dateto) as vacdateto, timefrom, description, '"+pconfig.uuid+"' as staffuuid,type, case when timefrom!=timeto then '0.' || (cast(substr(timeto,1,2) as int) - cast(substr(timefrom,1,2) as int)) else 1.0 end as dailyduration,null as hours,accepted FROM vacancycalendar where uuid='" + uuid.uuid + "';";
- //dump("EVSQL: " + evsql + "\n");
- evdata = appdb.dbquery(evsql);
- evdata = evdata.sqldata[0];
- if (evdata.type == -1){
- $("#btnacceptvacancy").hide();
- }else {
- $("#btnacceptvacancy").show();
- }
- if (evdata.hours >= maxdayhours) {
- evdata.hours=maxdayhours;
- $('#dailyduration select').val("1.0");
- } else if (evdata.hours == maxhalfdayhours){
- $('#dailyduration select').val("0.4");
- } else {
- $('#dailyduration select').val("0.");
- }
-
- }else {
- $('#dailyduration select').val("1.0");
- }
- for (var w in evdata) {
- if ((w == 'datefrom') || (w == 'dateto')) {
- w='vac' + w;
- }
-
- if ($("#frmeditvacancy #" + w)) {
- //dump(w + "->"+evdata[w]+"\n");
- if (w == "type"){
- $("#frmeditvacancy #" + w + " select").val(evdata[w]);
- } else {
- $("#frmeditvacancy #" + w).val(evdata[w]);
- }
-
-
- }
-
- }
-
- setdailydurationfields();
- $("#edit_vacancy").modal('show');
-}
-
-function confirm_delete_vacancy(uuid) {
- delvacation = uuid;
- $("#confirm_delete_vacancy").modal('show');
- return false;
-}
-
-function delete_vacancy() {
- var delsql = "DELETE FROM vacancycalendar where uuid='" + delvacation+"';";
- appdb.dbexec(delsql);
- load_table_vacancy();
- delvacancy=null;
- $("#confirm_delete_vacancy").modal('hide');
-
- return false;
-}
-
-function setdailydurationfields() {
- var dd = $('#dailyduration :selected').val();
- if (dd=='1.0') {
- //$("#ftimefrom").hide();
- $("#hours").prop("disabled",true);
- }else if (dd=='0.4') {
- //$("#ftimefrom").show();
- $("#hours").prop("disabled",true);
- }else if (dd=='0.') {
- //$("#ftimefrom").show();
- $("#hours").prop("disabled",false);
- }
-}
-
-function save_vacancy() {
- var type = 'ins';
- var cuuid = "";
- if ($("#frmeditvacancy #uuid").val() != 0) {
- type = 'upd';
- cuuid = $("#frmeditvacancy #uuid").val();
- }
- var evsvdata = {
- uuid:cuuid,
- datefrom: $("#frmeditvacancy #vacdatefrom").val(),
- dateto: $("#frmeditvacancy #vacdateto").val(),
- timefrom: $("#frmeditvacancy #timefrom").val(),
- hours: $("#frmeditvacancy #hours").val(),
- description: $("#frmeditvacancy #description").val(),
- staffuuid: $("#frmeditvacancy #staffuuid").val(),
- type: $("#frmeditvacancy #type").val()
- }
- var savesql = "";
- if (type == 'ins') {
- savesql = "INSERT INTO vacancycalendar (uuid, datefrom, dateto, timefrom, timeto, description, staffuuid, type,vacyear) VALUES "
- +"('" + appdb.generate_uuid() + "', date("+encodeparam(evsvdata.datefrom, 'date')+"), date("+encodeparam(evsvdata.dateto, 'date')+"), "+encodeparam(evsvdata.timefrom, 'text')+", strftime(\"%H:%M\",time("+encodeparam(evsvdata.timefrom, 'text')+",'+"+evsvdata.hours+" hours')), "+encodeparam(evsvdata.description, 'text')+", "+encodeparam(evsvdata.staffuuid, 'text')+","+evsvdata.type+","+encodeparam(evsvdata.datefrom, 'year')+");";
- } else {
- savesql = "UPDATE vacancycalendar SET vacyear=" + encodeparam(evsvdata.datefrom, 'year') + ", datefrom = date("+encodeparam(evsvdata.datefrom, 'date')+"), dateto = date("+encodeparam(evsvdata.dateto, 'date')+"), timefrom = "+encodeparam(evsvdata.timefrom, 'text')+", timeto = strftime(\"%H:%M\",time("+encodeparam(evsvdata.timefrom, 'text')+",'+"+evsvdata.hours+" hours')), description = "+encodeparam(evsvdata.description, 'text')+", staffuuid = "+encodeparam(evsvdata.staffuuid, 'text')+", type = "+evsvdata.type+" WHERE uuid = '"+evsvdata.uuid+"';";
- }
- //dump("VACSAVESQL:" + savesql + "\n");
- appdb.dbexec(savesql);
- load_table_vacancy();
-
- $("#frmeditvacancy #uuid").val("0");
- $("#edit_vacancy").modal('hide');
-}
-
-
-function set_selectyears() {
-
- var years = appdb.dbquery("select strftime('%Y',coalesce(min(entrydate),date('now','-1 year'))) as minyear, strftime('%Y',date('now', '+1 year')) as maxyear from staff where uuid='"+pconfig.uuid+"';");
- var minyear = parseInt(years.sqldata[0].minyear);
- var maxyear = parseInt(years.sqldata[0].maxyear);
- for (var y=minyear;y<=maxyear;y++){
-
- var sel = "";
- if (y == pconfig.year) {
- sel=' selected="1" ';
-
- }
-
- $(".selyear").append("<option value=\""+y+"\""+sel+">"+y+"</option>");
- }
-
-}
-
-// function calcvacancy() {
-// //"Calc Vacancy Data!\n");
-// var csel = "select days,hours from staffvacancydays where staffuuid='"+pconfig.uuid+"' and vacancyyear='"+pconfig.year+"';";
-// //"SQL:"+ csel +"\n");
-// var cnum = appdb.dbquery(csel);
-
-// if (cnum.sqldata.length > 0) {
-// if (pconfig.vacancyunit == "hours"){
-// if ((!cnum.sqldata[0].hours) || (cnum.sqldata[0].hours === "")){
-// cnum.sqldata[0].hours = cnum.sqldata[0].days * 8;
-// }
-// $('#vacancyyeartotal').val(cnum.sqldata[0].hours);
-// }else{
-// $('#vacancyyeartotal').val(cnum.sqldata[0].days);
-// }
-
-// }else {
-// $('#vacancyyeartotal').val("");
-// }
-// var vdays = (($('#vacancyyeartotal').val() === "")?"":cnum.sqldata[0].days);
-// var weekhours = $('#staff_weekhours').val();
-// if (vdays === '') {
-// $('#vacancystatus').html('<div class="alert alert-danger" style="padding: 2px;">Pas de jours de congés configuré pour l\'année '+ pconfig.year+'!</div>');
-// return;
-// }else if (weekhours === '') {
-// $('#vacancystatus').html('<div class="alert alert-danger">Pas de heures par semaine configurées!</div>');
-// return;
-// }
-
-// var vcalcsql = "select printf(\"%.2f\",(sum(dayhours) / ("+weekhours+"/5))) as days, printf(\"%.2f\",SUM(dayhours)) as hours,"+
-// "taken,type,accepted from (" +
-// "select vd.daydate,case when daydate <= date('now') then 1 else 0 end as taken,case when vc.timefrom=vc.timeto then cast ("+weekhours+"/5 as real) else cast(cast(strftime(\"%s\",vc.timeto) as int)- cast(strftime(\"%s\",vc.timefrom) as int) as real)/3600 end as dayhours,type,case when type != -1 then accepted else '1' end as accepted "+
-// "from vacancycalendar vc left join ( "+
-// "select daydate from ( ";
-// var df = new Date(pconfig.year,0,1);
-// var dt = new Date(pconfig.year,11,31);
-// var yd = [];
-// for (var dx=df;dx<=dt;dx.setDate(dx.getDate()+1)){
-// yd.push("select date('"+dx.toLocaleFormat('%Y-%m-%d')+"') as daydate");
-// }
-// vcalcsql += yd.join(" UNION ") +
-// ") yd where strftime('%w',daydate) not in ('0','6') and daydate not in (select vacancydate from vacancy where vacancydate between '"+pconfig.year+"-01-01' and '"+pconfig.year+"-12-31' and vacancydateto is null) " +
-// ") vd on (vd.daydate between vc.datefrom and vc.dateto) " +
-// "left join staffvacancydays svd on (vc.staffuuid=svd.staffuuid) " +
-// "where vc.staffuuid='"+pconfig.uuid+ "' and daydate is not null group by daydate) group by type,taken,accepted;";
-// //dump("SQL2:" + vcalcsql + "\n");
-// var vcalc = appdb.dbquery(vcalcsql);
-// vcalc = vcalc.sqldata;
-// //dump(JSON.stringify(vcalc)+ "\n");
-// vhours = vdays * 8;
-// var vac = {};
-// $("#lblyear").html(pconfig.year);
-// vac.normal = {taken:{hours:0,days:0},open:{vhours:parseFloat(vhours), days:parseFloat(vdays)},accepted:{hours:0,days:0},asked:{hours:0,days:0}};
-// vac.extra = {taken:{hours:0,days:0},open:{hours:0, days:0},accepted:{hours:0,days:0},asked:{hours:0,days:0}};
-// vac.ill = {taken:{hours:0,days:0},open:{hours:0, days:0},accepted:{hours:0,days:0},asked:{hours:0,days:0}};
-// vac.total = {taken:{hours:0,days:0},open:{hours:0, days:0},accepted:{hours:0,days:0},asked:{hours:0,days:0}};
-// //dump(JSON.stringify(vac) + "\n");
-// if (vcalc) {
-// for (var c in vcalc){
-// if (vcalc[c].type == '0' ){ //normal
-// if (vcalc[c].taken == '1'){
-// if (vcalc[c].accepted=='1'){
-// vac.normal.taken.days = vac.normal.taken.days + parseFloat(vcalc[c].days);
-// vac.normal.taken.hours = vac.normal.taken.hours + parseFloat(vcalc[c].hours);
-// } else {
-// vac.normal.asked.days = vac.normal.asked.days + parseFloat(vcalc[c].days);
-// vac.normal.asked.hours = vac.normal.asked.hours + parseFloat(vcalc[c].hours);
-// }
-
-// } else if (vcalc[c].taken == '0') {
-// if (vcalc[c].accepted=='1'){
-// vac.normal.accepted.days = vac.normal.accepted.days + parseFloat(vcalc[c].days);
-// vac.normal.accepted.hours = vac.normal.accepted.hours + parseFloat(vcalc[c].hours);
-// } else {
-// vac.normal.asked.days = vac.normal.asked.days + parseFloat(vcalc[c].days);
-// vac.normal.asked.hours = vac.normal.asked.hours + parseFloat(vcalc[c].hours);
-// }
-
-// }
-// vac.normal.open.days = parseFloat(vdays) - vac.normal.taken.days - vac.normal.accepted.days - vac.normal.asked.days;
-// vac.normal.open.hours = parseFloat(vhours) - vac.normal.taken.hours - vac.normal.accepted.hours - vac.normal.asked.hours;
-// //total
-
-// } else if (vcalc[c].type == '1' ){ //extra
-// if (vcalc[c].taken == '1'){
-// if (vcalc[c].accepted=='1'){
-// vac.extra.taken.days = vac.extra.taken.days + parseFloat(vcalc[c].days);
-// vac.extra.taken.hours = vac.extra.taken.hours + parseFloat(vcalc[c].hours);
-// } else {
-// vac.extra.asked.days = vac.extra.asked.days + parseFloat(vcalc[c].days);
-// vac.extra.asked.hours = vac.extra.asked.hours + parseFloat(vcalc[c].hours);
-// }
-// } else if (vcalc[c].taken == '0'){
-// if (vcalc[c].accepted=='1'){
-// vac.extra.accepted.days = vac.extra.accepted.days + parseFloat(vcalc[c].days);
-// vac.extra.accepted.hours = vac.extra.accepted.hours + parseFloat(vcalc[c].hours);
-// } else {
-// vac.extra.asked.days = vac.extra.asked.days + parseFloat(vcalc[c].days);
-// vac.extra.asked.hours = vac.extra.asked.hours + parseFloat(vcalc[c].hours);
-// }
-// }
-// vac.extra.open.days = 0;
-// vac.extra.open.hours = 0;
-// } else if (vcalc[c].type == '-1' ){ //ill
-// if (vcalc[c].taken == '1'){
-// vac.ill.taken.days = vac.ill.taken.days + parseFloat(vcalc[c].days);
-// vac.ill.taken.hours = vac.ill.taken.hours + parseFloat(vcalc[c].hours);
-// } else if (vcalc[c].taken == '0'){
-// if (vcalc[c].accepted=='1'){
-// vac.ill.accepted.days = vac.ill.accepted.days + parseFloat(vcalc[c].days);
-// vac.ill.accepted.hours = vac.ill.accepted.hours + parseFloat(vcalc[c].hours);
-// } else {
-// vac.ill.asked.days = vac.ill.asked.days + parseFloat(vcalc[c].days);
-// vac.ill.asked.hours = vac.ill.asked.hours + parseFloat(vcalc[c].hours);
-// }
-// }
-// vac.ill.open.days = 0;
-// vac.ill.open.hours = 0;
-
-// }
-// vac.total.taken.days = vac.normal.taken.days + vac.extra.taken.days + vac.ill.taken.days;
-// vac.total.taken.hours = vac.normal.taken.hours + vac.extra.taken.hours + vac.ill.taken.hours;
-// vac.total.open.days = vac.normal.open.days + vac.extra.open.days + vac.ill.open.days;
-// vac.total.open.hours = vac.normal.open.hours + vac.extra.open.hours + vac.ill.open.hours;
-// vac.total.accepted.days = vac.normal.accepted.days + vac.extra.accepted.days + vac.ill.accepted.days;
-// vac.total.accepted.hours = vac.normal.accepted.hours + vac.extra.accepted.hours + vac.ill.accepted.hours;
-// vac.total.asked.days = vac.normal.asked.days + vac.extra.asked.days + vac.ill.asked.days;
-// vac.total.asked.hours = vac.normal.asked.hours + vac.extra.asked.hours + vac.ill.asked.hours;
-// }
-// //JSON.stringify(vac) + "\n");
-// if (pconfig.vacancyunit == 'days'){
-// $("#vacnopen").html(((vac.normal.open.days && vac.normal.open.days != 0)?vac.normal.open.days.toFixed(2)+" j":" "));
-// $("#vacntaken").html(vac.normal.taken.days.toFixed(2)+" j");
-// $("#vacnasked").html(vac.normal.asked.days.toFixed(2)+" j");
-// $("#vacnplanned").html(vac.normal.accepted.days.toFixed(2)+" j");
-
-// $("#vaceopen").html(" ");
-// $("#vacetaken").html(vac.extra.taken.days.toFixed(2)+" j");
-// $("#vaceasked").html(vac.extra.asked.days.toFixed(2)+" j");
-// $("#vaceplanned").html(vac.extra.accepted.days.toFixed(2)+" j");
-
-// $("#vacmopen").html(" ");
-// $("#vacmtaken").html(vac.ill.taken.days.toFixed(2)+" j");
-// $("#vacmasked").html(vac.ill.asked.days.toFixed(2)+" j");
-// $("#vacmplanned").html(vac.ill.accepted.days.toFixed(2)+" j");
-
-// $("#vactopen").html(vac.total.open.days.toFixed(2)+" j");
-// $("#vacttaken").html(vac.total.taken.days.toFixed(2)+" j");
-// $("#vactasked").html(vac.total.asked.days.toFixed(2)+" j");
-// $("#vactplanned").html(vac.total.accepted.days.toFixed(2)+" j");
-// } else {
-// vac.normal.open.hours=vac.normal.open.hours + parseInt($("#vacancylastyearrest").val());
-// $("#vacnopen").html(((vac.normal.open.hours && vac.normal.open.hours != 0)?vac.normal.open.hours.toFixed(2)+" h":" "));
-// $("#vacntaken").html(((vac.normal.taken.hours && vac.normal.taken.hours > 0)?vac.normal.taken.hours.toFixed(2)+" h":" "));
-// $("#vacnasked").html(((vac.normal.asked.hours && vac.normal.asked.hours > 0)?vac.normal.asked.hours.toFixed(2)+" h":" "));
-// $("#vacnplanned").html(((vac.normal.accepted.hours && vac.normal.accepted.hours > 0)?vac.normal.accepted.hours.toFixed(2)+" h":" "));
-
-// $("#vacetaken").html(((vac.extra.taken.hours && vac.extra.taken.hours > 0)?vac.extra.taken.hours.toFixed(2)+" h":" "));
-// $("#vaceasked").html(((vac.extra.asked.hours && vac.extra.asked.hours > 0)?vac.extra.asked.hours.toFixed(2)+" h":" "));
-// $("#vaceplanned").html(((vac.extra.accepted.hours && vac.extra.accepted.hours > 0)?vac.extra.accepted.hours.toFixed(2)+" h":" "));
-
-// $("#vacmtaken").html(((vac.ill.taken.hours && vac.ill.taken.hours > 0)?vac.ill.taken.hours.toFixed(2)+" h":" "));
-// $("#vacmasked").html(((vac.ill.asked.hours && vac.ill.asked.hours > 0)?vac.ill.asked.hours.toFixed(2)+" h":" "));
-// $("#vacmplanned").html(((vac.ill.accepted.hours && vac.ill.accepted.hours > 0)?vac.ill.accepted.hours.toFixed(2)+" h":" "));
-
-// $("#vactopen").html(((vac.total.open.hours && vac.total.open.hours > 0)?vac.total.open.hours.toFixed(2)+" h":" "));
-// $("#vacttaken").html(((vac.total.taken.hours && vac.total.taken.hours > 0)?vac.total.taken.hours.toFixed(2)+" h":" "));
-// $("#vactasked").html(((vac.total.asked.hours && vac.total.asked.hours > 0)?vac.total.asked.hours.toFixed(2)+" h":" "));
-// $("#vactplanned").html(((vac.total.accepted.hours && vac.total.accepted.hours > 0)?vac.total.accepted.hours.toFixed(2)+" h":" "));
-
-// }
-
-// //dump(JSON.stringify(vac) + " - Set data vacancy status\n");
-// // var hdata = " <span style=\"font-weight: normal;\"><span style=\"text-decoration: underline;\">pris:</span> <strong>"+ vac.taken.hours +" h</strong> ("+ vac.taken.days.toFixed(2)+" jour(s)) - ";
-// // hdata += " <span style=\"text-decoration: underline;\">planifié:</span> <strong>"+ vac.rest.hours+" h</strong> ("+ vac.rest.days.toFixed(2)+" jour(s)) - ";
-// // hdata += " <span style=\"text-decoration: underline;\">ouvert:</span> <strong>"+ vac.open.hours +" h</strong> ("+ vac.open.days.toFixed(2)+" jour(s))";
-// // if (vac.ill > 0) {
-// // hdata += " - (<span style=\"text-decoration: underline;\">maladie:</span> <strong>"+ vac.ill.hours+" h</strong> ("+ vac.ill.days.toFixed(2)+" jour(s)))</span>";
-// // }
-// //dump("HTML: --" + document.getElementById("vacancystatus").innerHTML +"//\n->" + hdata + "\n");
-// //$("#vacancystatus").html("");
-// //if ($("#vacancystatus")){
-// //dump("vacancystatus exists\n");
-// //
-// //}
-// $("#vacancystatus").html("");
-// }
-// else {
-// $("#vacancystatus").html("");
-// }
-// }
-
-function saveyearvacdays() {
- var csel = "select * from staffvacancydays where staffuuid='"+pconfig.uuid+"' and vacancyyear='"+pconfig.year+"';";
- var days = 0;
- var hours = 0;
- if ($('#vacancyyeartotal').val() === ""){
- return;
- }
- if (pconfig.vacancyunit == "hours"){
- days = parseFloat($('#vacancyyeartotal').val().replace(',','.')) / 8;
- hours = $('#vacancyyeartotal').val();
- }else {
- days = parseFloat($('#vacancyyeartotal').val().replace(',','.'));
- hours = parseFloat($('#vacancyyeartotal').val().replace(',','.')) * 8;
- }
- var cnum = appdb.dbquery(csel);
- var inssql = "INSERT INTO staffvacancydays (staffuuid,vacancyyear,days,hours) VALUES ('"+pconfig.uuid+"','"+pconfig.year+"',"+days+","+hours+");";
- if (cnum.sqldata.length > 0) {
- inssql = "UPDATE staffvacancydays SET days="+days+",hours="+hours+" where staffuuid='"+pconfig.uuid+"' and vacancyyear='"+pconfig.year+"';";
- }
- appdb.dbexec(inssql);
- //calcvacancy();
-}
-
-// function setvacancyunit(){
-// var vacunit = $('#vacancy_unit').val();
-// if ($('#vacancyyeartotal').val() !== ""){
-// var vacval = parseFloat($('#vacancyyeartotal').val().replace(',','.'));
-// if (((!pconfig.vacancyunit) || (pconfig.vacancyunit == 'days')) && (vacunit == 'hours')){
-// $('#vacancyyeartotal').val(vacval * 8);
-// }else if (pconfig.vacancyunit != vacunit){
-// $('#vacancyyeartotal').val(vacval / 8);
-// }
-// }
-// //dump("vacunit: " + vacunit + "\n");
-// pconfig.vacancyunit = vacunit;
-// apppref.setpreference("pageconfig.coworker",pconfig);
-// }
-
-function dlg_event(uuid, type) {
-
- //$('#staffuuid').multiselect('deselectAll', false);
- //$('#staffuuid').multiselect('updateButtonText');
- if (type== "ins") {
-
- $('#btndeleteevent').hide();
-
- }else {
- $('#btndeleteevent').show();
- }
- $('#frmeditevent #freqinterval').hide();
- $('#frmeditevent #freqmonthly').hide();
- $('#frmeditevent #freqweekly').hide();
- $('#frmeditevent #freq_monthly_byday').show();
- $('#frmeditevent #freq_monthly_bymonthday').hide();
- $('#frmeditevent #freq').val("");
- $('#frmeditevent .active').removeClass('active');
- if ((type == 'upd') || (type == 'ins')) {
-
- var evdata = {
- uuid: '0',
- description: '',
- activityuuid:'',
- location: '',
- color: '',
- datefrom:new Date().toLocaleFormat("%d.%m.%Y"),
- dateto:'',
- staffuuid: pconfig.uuid,
- timefrom: '00:00',
- timeto: '00:00',
- freq: '',
- staffname: $("#staff_prename").val() + " " + $("#staff_surname").val()
- };
- //jsdump(JSON.stringify(pconfig) + "\n");
- //jsdump(JSON.stringify(evdata) + "\n");
- if (type == 'upd') {
- var evsql = "SELECT uuid, strftime(\"%d.%m.%Y\",datefrom) as datefrom, strftime(\"%d.%m.%Y\",dateto) as dateto, timefrom, timeto, description, location, color, freq, '"+ pconfig.uuid+"' as staffuuid FROM eventcalendar ev left join staffplanning st on (ev.uuid=st.eventcalendaruuid) where ev.uuid='" + uuid.uuid + "' group by ev.uuid;";
- evdata = appdb.dbquery(evsql);
- evdata = evdata.sqldata[0];
- evdata['staffname'] = $("#staff_prename").val() + " " + $("#staff_surname").val();
- if (evdata.freq != '') {
- var tmpfreq = evdata.freq.split(';');
- for (var t in tmpfreq){
- if (tmpfreq[t] != '') {
- var spl = tmpfreq[t].split("=");
- evdata[spl[0].toLowerCase()] = spl[1].toLowerCase();
- }
- }
- }
- }
- for (var w in evdata) {
- if ($("#frmeditevent #" + w)) {
- // if (w == 'staffuuid') {
- // if (evdata[w] == '') {
- // $("#frmeditevent #" + w).multiselect('select',[]);
- // } else {
- // $("#frmeditevent #" + w).multiselect('select',evdata[w].split(','));
- // }
-
- // }
- // else if (w == 'color') {
- // $("#frmeditevent #color").val(evdata[w]);
- // $('#frmeditevent #color').minicolors('value',{color: evdata[w]});
- // }
- // else {
- $("#frmeditevent #" + w).val(evdata[w]);
- // }
- }
- }
- if ((evdata.freq == 'weekly') && (evdata.byday)) {
- var bd = evdata.byday.split(',');
- for (var i in bd){
- document.getElementById('weekly_byday_' + bd[i]).setAttribute("checked",true);
- $('#frmeditevent #weekly_byday_' + bd[i]).parent().addClass("active");
- }
- }
- if (evdata.freq == 'monthly') {
- $('#freq_monthly_byday').hide();
- $('#freq_monthly_bymonthday').hide();
- $('#pnl_monthly_byday').removeAttr("checked");
- $('#pnl_monthly_bymonthday').removeAttr("checked");
- if (evdata.byday) {
- document.getElementById('pnl_monthly_byday').setAttribute("checked",true);
- $('#frmeditevent #pnl_monthly_byday').parent().addClass("active");
- $('#freq_monthly_byday').show();
- var bd = evdata.byday.split(',');
- var adpos = new Array();
- var awday = new Array();
- for (var i in bd){
- var wday = bd[i].substr(bd[i].length-2);
- var pos = bd[i].substring(0,bd[i].length-2);
- awday.push(wday.toLowerCase());
- adpos.push(pos);
- }
-
- for (var i in adpos){
- document.getElementById('monthly_bydaypos_' + adpos[i]).setAttribute("checked",true);
- $('#frmeditevent #monthly_bydaypos_' + adpos[i]).parent().addClass("active");
- }
- for (var i in awday){
- document.getElementById('monthly_bydaywday_' + awday[i]).setAttribute("checked",true);
- $('#frmeditevent #monthly_bydaywday_' + awday[i]).parent().addClass("active");
- }
- }else if (evdata.bymonthday) {
- document.getElementById('pnl_monthly_bymonthday').setAttribute("checked",true);
- $('#frmeditevent #pnl_monthly_bymonthday').parent().addClass("active");
- $('#freq_monthly_bymonthday').show();
- var bd = evdata.bymonthday.split(',');
- for (var i in bd){
- document.getElementById('monthly_bymonthday_' + bd[i]).setAttribute("checked",true);
- $('#frmeditevent #monthly_bymonthday_' + bd[i]).parent().addClass("active");
- }
- }
- }
- setfreq();
- $("#edit_event").modal('show');
- }
-}
-
-
-function save_event() {
- var sql1 = new Array();
- var sql2 = new Array();
- if ($('#timefrom').val() == $('#timeto').val() || $('#timefrom').val() == "00:00" || $('#timeto').val() == "00:00"){
- errormsg("Erreur","les heures doivent être différent et différent de la valeur 00:00!");
- return false;
- }
- if ($('#timefrom').val() > $('#timeto').val()){
- errormsg("Erreur","l'heure de début ne peux pas être supérieur à l'heure de fin!");
- return false;
- }
- if (!$('#staffuuid').val()){
- errormsg("Erreur","Vous devez selectionner au moin 1 membre du staff!");
- return false;
- }
- if ($('#dateto').val() != '' && (encodeparam($('#datefrom').val()) > encodeparam($('#dateto').val())) ) {
- errormsg("Erreur","La Date début ne peut pas être supérieur à la date fin!");
- return false;
- }
- var type = 'ins';
- var cuuid = "";
- if ($("#frmeditevent #uuid").val() != 0) {
- type = 'upd';
- cuuid = $("#frmeditevent #uuid").val();
- } else {
- cuuid = appdb.generate_uuid();
- }
- var freqdata = {};
- var cfreq = $("#frmeditevent #freq").val();
- $("#frmeditevent :input").each(function() {
- var input = $(this);
-
- if (input.attr("id") && (input.attr("id") != "staffuuid") && (input.attr("id") != "staffname")) {
- if ((input.attr("type") == "checkbox") && (input.attr("id").indexOf(cfreq) >= 0)){
- var xd = input.attr("id").split("_");
- if (input.attr("checked")) {
- if (!freqdata[xd[1]]) {
- freqdata[xd[1]] = new Array();
- }
- freqdata[xd[1]].push(input.val());
- }
- }
- else if ((input.attr("type") == "radio") && (input.attr("id").indexOf(cfreq) >= 0)) {
- var xd = input.attr("id").split("_");
- if (input.attr("checked")) {
- freqdata['freqtype'] = xd[2];
- }
- }
- else if ((input.attr("type") != "checkbox") && ((input.attr("type") != "radio"))){
- if ((input.attr("id") == 'interval') || (input.attr("id") == 'freq')) {
- freqdata[input.attr("id")] = input.val();
- } else if ((type == 'ins') && (input.attr("id") != 'staffuuid')) {
-
- sql1.push('"' + input.attr("id") + '"');
- if (input.attr("id") == 'uuid') {
- if (input.val() == "" || input.val() == "0") {
- sql2.push("'" + cuuid + "'");
- } else {
- sql2.push("'" + input.val() + "'");
- }
- } else {
- var ival = encodeparam(input.val(), input.attr('type'));
- sql2.push(ival);
- }
- } else {
- if ((input.attr("id") != 'uuid') && (input.attr("id") != 'staffuuid')){
- var ival = encodeparam(input.val(), input.attr('type'));
- sql2.push('"' + input.attr("id") + '"=' + ival);
- }
- }
- }
- }
-
- });
- if (!freqdata.freqtype) {
- freqdata['freqtype'] = curfreq.freqtype;
- }
-
- var strfreq ="";
- if (cfreq != "") {
- strfreq='FREQ=' + cfreq.toUpperCase()+';INTERVAL=' + freqdata.interval +';';
- if ((cfreq == 'weekly') && (freqdata.byday)){
- strfreq += 'BYDAY=' + freqdata.byday.join(",");
- }
- if ((cfreq == 'monthly') && (freqdata.bydaypos) || ((freqdata.bydaywday)) || (freqdata.bymonthday)){
- strfreq += freqdata.freqtype.toUpperCase() + '=';
- if (freqdata.freqtype == 'bymonthday') {
- strfreq += freqdata.bymonthday.join(',') + ";"
- }else {
- var abyday = new Array();
- for (var p in freqdata.bydaypos){
- for (var w in freqdata.bydaywday){
- abyday.push(freqdata.bydaypos[p] + freqdata.bydaywday[w]);
- }
- }
- strfreq += abyday.join(",");
- }
- }
- if (strfreq.slice(-1) == ';') {
- strfreq = strfreq.substring(0,strfreq.length-1);
- }
- }
- var staffuuids = $('#staffuuid').val();
- var delsql = "";
- var xsql = [];
- if (type != 'ins') {
- xsql.push("DELETE FROM staffplanning where eventcalendaruuid = '"+cuuid+"';");
- }
- var staffinssql = "";
-
- if (staffuuids && (staffuuids.length != 0)) {
-
- staffinssql = "INSERT INTO staffplanning (eventcalendaruuid,staffuuid) VALUES ";
- var tmps = [];
- var curcoworkerok = false;
- for (var s in staffuuids){
- if (staffuuids[s] == pconfig.uuid){
- curcoworkerok = true;
- }
- tmps.push("('"+cuuid+"','"+staffuuids[s]+"')");
- }
- if (!curcoworkerok){
- tmps.push("('"+cuuid+"','"+pconfig.uuid+"')");
- }
- staffinssql += tmps.join(',') + ";";
- xsql.push(staffinssql);
- }
- if (staffuuids.length == 0){
- staffinssql = "INSERT INTO staffplanning (eventcalendaruuid,staffuuid) VALUES ('"+cuuid+"','"+pconfig.uuid+"');";
- xsql.push(staffinssql);
- }
-
-
-
- if (type == 'upd') {
- sql2.push('freq=' + encodeparam(strfreq));
- xsql.push("UPDATE eventcalendar SET " + sql2.join(',') + " where \"uuid\"='" + cuuid + "';");
- } else {
- sql1.push('freq');
- sql2.push(encodeparam(strfreq));
- xsql.push("INSERT INTO eventcalendar (" + sql1.join(',') + ") VALUES (" + sql2.join(',') + ");");
- }
- dump(JSON.stringify(xsql));
- for (var i in xsql){
- appdb.dbexec(xsql[i]);
- }
-
- load_event_data();
-
- $("#frmeditevent #uuid").val("0");
- $("#edit_event").modal('hide');
-}
-
-function confirm_delete_event() {
- $("#confirm_delete_event").modal('show');
- return false;
-}
-
-function delete_event() {
- appdb.dbexec("DELETE FROM eventcalendar where uuid='" + $('#frmeditevent #uuid').val()+"';");
- appdb.dbexec("DELETE FROM staffplanning where eventcalendaruuid='" + $('#frmeditevent #uuid').val()+"';");
- load_event_data();
- $("#confirm_delete_event").modal('hide');
-
- return false;
-}
-
-
-
-function setfreq() {
-
- curfreq.freq = $('#freq option:selected').val();
-
- $('#freqinterval').hide();
- $('#freqmonthly').hide();
- $('#freqweekly').hide();
- if (curfreq.freq != "") {
-
- $('#lblfreq').text(lblfreq[curfreq.freq]);
- $('#freqinterval').show();
- if (curfreq.freq != 'daily') {
- $('#freq' + curfreq.freq).show();
- }
- }
-
-}
-
-// function load_staff_selection(objid,option){
-// var stdata = appdb.dbquery("select uuid, coalesce(surname,'') || ' ' || coalesce(prename,'') as name,case when color is null then '#000' else color end as color from staff order by surname,prename");
-
-// stdata = stdata.sqldata;
-// for (var s in stdata){
-// $('#' + objid).append('<option value="'+ stdata[s].uuid+'"><span style="color: '+stdata[s].color+';" >' +stdata[s].name+ '</span></option>');
-// }
-
-// var copt = {};
-// if (option) {
-// copt = option;
-// }
-// copt['enableHTML'] = true;
-// copt['nonSelectedText']="Sélectionner un(e) employé(e)...";
-// copt['numberDisplayed']=5;
-// copt['allSelectedText']='Tous';
-// copt['nSelectedText']=' selections';
-
-// $('#' + objid).multiselect(copt);
-
-// }
-
-function accept_vacancy(){
- var cuuid = "";
- if ($("#frmeditvacancy #uuid").val() != 0) {
- type = 'upd';
- cuuid = $("#frmeditvacancy #uuid").val();
- }
- var xsql = "UPDATE vacancycalendar SET accepted='1' where \"uuid\"='" + cuuid + "';";
- appdb.dbexec(xsql);
- load_table_vacancy();
-
- $("#frmeditvacancy #uuid").val("0");
- $("#edit_vacancy").modal('hide');
-}
-
-function getlastyearsrest(){
- var weekhours = $('#staff_weekhours').val();
- if (weekhours === '') {
- $("#vacancylastyearrest").val(0);
- return;
- }
- var df = new Date(pconfig.year-1,0,1);
- var dt = new Date(pconfig.year-1,11,31);
- var vcalcrestsql = "select (select hours from staffvacancydays where staffuuid='"+pconfig.uuid+ "' and vacancyyear="+df.getFullYear()+")-SUM(dayhours) AS hours from (" +
- "select vd.daydate,case when daydate <= date('now') then 1 else 0 end as taken,case when vc.timefrom=vc.timeto then cast ("+weekhours+"/5 as real) else (cast (substr(vc.timeto,1,2) as int) + (cast(substr(vc.timeto,4,5) as int)/60)) - (cast(substr(vc.timefrom,1,2) as int) + (cast(substr(vc.timeto,4,5) as int)/60)) end as dayhours,type,case when type != -1 then accepted else '1' end as accepted "+
- "from vacancycalendar vc left join ( "+
- "select daydate from ( ";
-
- var yd = [];
- for (var dx=df;dx<=dt;dx.setDate(dx.getDate()+1)){
- yd.push("select date('"+dx.toLocaleFormat('%Y-%m-%d')+"') as daydate");
- }
- vcalcrestsql += yd.join(" UNION ") +
- ") yd where strftime('%w',daydate) not in ('0','6') and daydate not in (select vacancydate from vacancy where vacancydate between '"+df.getFullYear()+"-01-01' and '"+dt.getFullYear()+"-12-31' and vacancydateto is null) " +
- ") vd on (vd.daydate between vc.datefrom and vc.dateto) " +
- "left join staffvacancydays svd on (vc.staffuuid=svd.staffuuid) " +
- "where vc.staffuuid='"+pconfig.uuid+ "' and daydate is not null group by daydate) where type in (0,1) and taken=1 and accepted=1 group by taken,accepted;";
- //dump("SQLREST:" + vcalcrestsql + "\n");
- var vcalc = appdb.dbquery(vcalcrestsql);
- //dump(JSON.stringify(vcalc) + "\n");
- if (vcalc && vcalc.sqldata[0]){
-
- $("#vacancylastyearrest").val(vcalc.sqldata[0].hours);
- }else {
- $("#vacancylastyearrest").val(0);
- }
- return;
-}
+++ /dev/null
-//Source-code licensed under EUPL v1.1 ( Copyright 2016 By DKS s.à r.l. - Kilian Saffran - Luxembourg )
-var pconfig = null;
-var delplan = null;
-var delvacation = null;
-var wh= window.innerHeight -440;
-var curdatediff = null;
-var redate = /\d\d.\d\d.\d\d\d\d/;
-var curfreq ={};
-//var lictype = apppref.getpreference("support.lictype");
-
-function initdata() {
- load_helpers();
- var pdata = apppref.getpreference("pageconfig.coworker");
- if (pdata != '') {
- pconfig = JSON.parse(pdata);
- }
- //"get CoWorker cfg:" +JSON.stringify(pconfig) + "\n");
- if (!pconfig.year) {
- pconfig.year=new Date().getFullYear();
- }
- if (!pconfig.printlayout) {
- pconfig.printlayout = 'list';
- apppref.setpreference("pageconfig.coworker",pconfig);
- }
- var cdatasql = "SELECT jobtitle, prename, surname, address, zip, city, country, strftime('%d.%m.%Y',entrydate) as entrydate, strftime('%d.%m.%Y',exitdate) as exitdate, iban, bic, accountname, phone, email, uuid,color,weekhours,case when password is not null and length(password) > 3 then 1 else 0 end as passwordset FROM staff where uuid='" + pconfig.uuid + "';";
- var cdata = appdb.dbquery(cdatasql);
- cdata = cdata.sqldata[0];
- for (var ci in cdata) {
- if (document.getElementById("staff_" + ci)) {
-
- $("#staff_" + ci).val(cdata[ci]);
- if (ci == "color"){
- $("#staff_color").css("background-color",cdata[ci]);
- $("#staff_color").val("");
- }
-
- }
-
- }
- var crdata = appdb.dbquery("select stafflist from creche;");
- if ((crdata) && (crdata.sqldata[0].stafflist == "1")){
- $("#pwddata").hide();
- }
- if (cdata) {
- set_infoheader(cdata.prename + " " + cdata.surname);
- }
- set_selectyears();
-
- if (pconfig && pconfig.activetab) {
- $('a[href="#'+pconfig.activetab+'"]').tab('show');
- }else{
- $('a[href="#vacancy"]').tab('show');
- pconfig.activetab = 'vacancy';
- }
-
-//if (pconfig && pconfig.vacancyunit){
-////dump("has vacancy unit:" + pconfig.vacancyunit + "\n");
-//$('#vacancy_unit').val(pconfig.vacancyunit);
-//}else {
-pconfig.vacancyunit = "hours";
-//$('#vacancy_unit').val("days");
-//}
-
- $('#frmeditvacancy #vacdatefrom').on("blur",function (e) {
- var ok = true;
- if ($('#frmeditvacancy #vacdatefrom').val().match(redate)) {
- $('#btn_save_vacancy').removeAttr("disabled");
- }else {
- ok = false;
- $('#btn_save_vacancy').attr("disabled","1");
- }
- if ((ok == true) && ($('#frmeditvacancy #vacdateto').val() != '')) {
- var tmpdt1 = encodeparam($('#frmeditvacancy #vacdatefrom').val(),'date');
- var nd = new Date(tmpdt1.replace(/'/g,''));
- var xd = new Date(nd.getFullYear(),nd.getMonth(),nd.getDate() + curdatediff);
- $('#frmeditvacancy #vacdateto').val(xd.toLocaleFormat("%d.%m.%Y"));
- var tmpdt2 = encodeparam($('#frmeditvacancy #vacdateto').val(),'date');
- if (tmpdt1 > tmpdt2) {
- $('#btn_save_vacancy').attr("disabled","1");
- } else {
- $('#btn_save_vacancy').removeAttr("disabled");
- }
-
- }
- });
- $('#frmeditvacancy #vacdateto').on("blur",function (e) {
- var ok = true;
- if ($('#frmeditvacancy #vacdateto').val().match(redate)) {
- $('#btn_save_vacancy').removeAttr("disabled");
- }else {
- ok = false;
- $('#btn_save_vacancy').attr("disabled","1");
- }
- curdatediff=daysBetween(new Date(encodeparam($('#frmeditvacancy #vacdatefrom').val(),'date').replace(/'/g,'')),new Date(encodeparam($('#frmeditvacancy #vacdateto').val(),'date').replace(/'/g,'')));
- if ((ok == true) && ($('#frmeditvacancy #vacdateto').val() != '')) {
- var tmpdt1 = encodeparam($('#frmeditvacancy #vacdatefrom').val(),'date');
- var tmpdt2 = encodeparam($('#frmeditvacancy #vacdateto').val(),'date');
- if (tmpdt1 > tmpdt2) {
- $('#btn_save_vacancy').attr("disabled","1");
- } else {
- $('#btn_save_vacancy').removeAttr("disabled");
- }
-
- }
- });
-
-
- $("#weekly_byday :input").change(function() {
- if (this.checked) {
- this.setAttribute("checked",true);
- }else {
- this.removeAttribute("checked");
- }
-
-});
- $("#monthly_bydaypos :input").change(function() {
-
- if (this.checked) {
- this.setAttribute("checked",true);
- }else {
- this.removeAttribute("checked");
- }
-
-});
- $("#monthly_bydaywday :input").change(function() {
-
- if (this.checked) {
- this.setAttribute("checked",true);
- }else {
- this.removeAttribute("checked");
- }
-
-});
- $("#monthly_bymonthday :input").change(function() {
-
- if (this.checked) {
- this.setAttribute("checked",true);
- }else {
- this.removeAttribute("checked");
- }
-
-});
- $("#monthly_by :input").change(function() {
- var xd = this.id.split("_");
- curfreq.freqtype=xd[2];
-
- this.setAttribute("checked",true);
-
- $('#freq_monthly_byday').hide();
- $('#freq_monthly_bymonthday').hide();
- $('#pnl_monthly_byday').removeAttr("checked");
- $('#pnl_monthly_bymonthday').removeAttr("checked");
-
- $('#freq_' + this.value).show();
-
-});
-
- $('#frmeditevent #datefrom').on("blur",function (e) {
- var ok = true;
- if ($('#frmeditevent #datefrom').val().match(redate)) {
- $('#btn_save_event').removeAttr("disabled");
- }else {
- ok = false;
- $('#btn_save_event').attr("disabled","1");
- }
- if ((ok == true) && ($('#frmeditevent #dateto').val() != '')) {
- var tmpdt1 = encodeparam($('#frmeditevent #datefrom').val(),'date');
- var tmpdt2 = encodeparam($('#frmeditevent #dateto').val(),'date');
- if (tmpdt1 >= tmpdt2) {
- $('#btn_save_event').attr("disabled","1");
- } else {
- $('#btn_save_event').removeAttr("disabled");
- }
-
- }
- });
- $('#frmeditevent #dateto').on("blur",function (e) {
- var ok = true;
- if ($('#frmeditevent #dateto').val().match(redate)) {
- $('#btn_save_event').removeAttr("disabled");
- }else {
- ok = false;
- $('#btn_save_event').attr("disabled","1");
- }
- if ((ok == true) && ($('#frmeditevent #dateto').val() != '')) {
- var tmpdt1 = encodeparam($('#frmeditevent #datefrom').val(),'date');
- var tmpdt2 = encodeparam($('#frmeditevent #dateto').val(),'date');
-
- if (tmpdt1 >= tmpdt2) {
- $('#btn_save_event').attr("disabled","1");
- } else {
- $('#btn_save_event').removeAttr("disabled");
- }
-
- }
- });
-
-}
-
-$('.selyear').on( "change", function(e){
- e.preventDefault();
-
- $(".selyear").val($(this).val());
- pconfig.year = $(this).val();
- apppref.setpreference("pageconfig.coworker",pconfig);
- if ($(this).attr('id') == "year_organisation") {
- load_event_data();
- }else if ($(this).attr('id') == "year_vacancy") {
- load_table_vacancy();
- }
-});
-
-$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
- var tn = e.target.toString();
- pconfig.activetab = tn.substring(tn.lastIndexOf("#")+1);
- //dump(JSON.stringify(pconfig) + "\n");
- apppref.setpreference("pageconfig.coworker",pconfig);
- if (pconfig.activetab == 'activity') {
- load_event_data();
- }
- if (pconfig.activetab == 'vacancy') {
- load_table_vacancy();
- }
- });
-
-function load_event_data() {
- var where = new Array();
-
- where.push(" st.uuid in ('"+ pconfig.uuid + "')");
-
- $("div.panel-daybody").html("");
- var sql = "SELECT cal.uuid, cal.datefrom, cal.dateto, '<div style=\"display:none;\">' || strftime('%Y%m%d',cal.datefrom) ||'</div>' || strftime('%d.%m.%Y',cal.datefrom) AS tbldatefrom ,strftime('%Y%m%d',cal.datefrom) AS strdatefrom, strftime('%Y%m%d',cal.dateto) AS strdateto,cal.timefrom, cal.timeto, cal.description, cal.location, cal.color, cal.freq, '[\"' || GROUP_CONCAT(sp.staffuuid,'\",\"') || '\"]' as staffuuid, GROUP_CONCAT(coalesce(st.surname,'') || ' ' || coalesce(st.prename,''), '<br/>' ) as staffnames ,'[\"' || GROUP_CONCAT(st.color,'\",\"') || '\"]' as staffcolors from eventcalendar cal " +" join staffplanning sp on (cal.uuid=sp.eventcalendaruuid " + " AND sp.staffuuid in ('"+ pconfig.uuid +"')) left join staff st on (sp.staffuuid=st.uuid) "+
- " where (cal.datefrom between '" + $('#year_organisation').val() + "-01-01' and '" + $('#year_organisation').val() + "-12-31' and (cal.dateto >= '" + $('#year_organisation').val() + "-01-01' or cal.dateto is null)) or (cal.dateto between '" + $('#year_organisation').val() + "-01-01' and '" + $('#year_organisation').val() + "-12-31' and cal.datefrom < '" + $('#year_organisation').val() + "-01-01') or ((cal.datefrom <= '" + $('#year_organisation').val() + "-01-01') and ((cal.dateto >= '" + $('#year_organisation').val() + "-12-31') or cal.dateto is null)) "+ ((where.length > 0)?" AND (" + where.join(" or ") + ")":"")+" group by cal.uuid order by cal.datefrom,cal.dateto;";
-
- var caldata = appdb.dbquery(sql);
-
- caldata = caldata.sqldata;
-
- var headerdata = getlabels("act,activity,datefrom,hours,recurrance");
- $("#tbl_activity").html("");
-
- var hrow = headerdata;
- var tdclass= new Array();
- var tblheader = '<tr>';
-
- for (var h=0;h<hrow.length;h++){
- tdclass.push(headerdata[h].class);
- tblheader += '<th class="' + headerdata[h].class +'">'+ headerdata[h].title+'</th>';
- }
- tblheader += '</tr>';
-
- $("#tbl_activity").append("<thead>" + tblheader + "</thead>");
- $("#tbl_activity").append("<tbody>");
- var tblbody = [];
- for (var c in caldata) {
- var tblrow = "<tr>";
- tblrow += '<td class="noprint"> </td>';
- tblrow += "<td><span style=\"display: none;\">"+caldata[c].description+"</span><strong style=\"color:"+ caldata[c].color +"\">" + caldata[c].description + "</strong></td>";
- tblrow += "<td>" + caldata[c].tbldatefrom + "</td>";
- tblrow += "<td>" + caldata[c].timefrom + "- " + caldata[c].timeto + "</td>";
-
- var freq2 = caldata[c].freq;
- if (freq2 != '') {
-
- freq2 += ';DTSTART='+caldata[c].strdatefrom + 'T000000Z';
- if (caldata[c].dateto != ''){
- freq2 += ';UNTIL='+caldata[c].strdateto + 'T000000Z';
- }
- }
-
- try {
-
- var rule2 = RRule.fromString(freq2);
-
-
- tblrow += "<td>" + rule2.toText() + "</td>";
-
- } catch (ex){
- //"ERROR! loading data!" + ex + " FREQ:" + freq2 + "\n");
- }
- tblrow += "</tr>";
- tblbody.push(tblrow);
- }
-
- //load table
- $("#tbl_activity").append(tblbody.join(''));
- $("#tbl_activity").append("</tbody>");
-
- tblcal = $("#tbl_activity").dataTable({
- "language": {
- "url": "../../web/js/locale/datatable_fr.json"
- },
- "paging": false,
- "scrollY": wh + "px",
- "scrollCollapse": true,
- "ordering": true,
- "info": false,
- "filter": false,
- "destroy": true
- });
-
- //$('#tbl_activity').on( 'search.dt', function () {
- //
- // pconfig.filter = tblcal.api().search();
- //
- // apppref.setpreference("pageconfig.calactivity",pconfig);
- //} );
-
- //$('#tbl_activity').on( 'order.dt', function () {
- // pconfig.order= tblcal.fnSettings().aaSorting;
- //
- // apppref.setpreference("pageconfig.calactivity",pconfig);
- //
- //} );
-
-// if (pconfig.filter) {
-// tblcal.fnFilter(pconfig.filter);
-// }
- if (pconfig.order) {
- tblcal.fnSort(pconfig.order);
- }
- if (/*(!pconfig.filter) && */ (!pconfig.order)) {
- tblcal.fnDraw();
- }
-}
-
-function load_table_vacancy() {
-
- var vacdatasql = "SELECT case when (datefrom > date('now') or accepted!='1') and type != -1 then '<button type=\"button\" class=\"btn btn-primary\" onclick=\"dlg_vacancy({''uuid'':'''|| uuid || '''},''upd'');\"><span class=\"glyphicon glyphicon-pencil\"></span></button> <button type=\"button\" class=\"btn btn-danger\" onclick=\"confirm_delete_vacancy(''' || uuid || ''');\"><span class=\"glyphicon glyphicon-remove\"></span></button>' else ' ' end AS action," +
- "CASE WHEN datefrom!=dateto THEN 'du:' || strftime('%d.%m.%Y', CASE WHEN datefrom < DATE('"+ pconfig.year +"-01-01') THEN DATE('"+ pconfig.year +"-01-01') ELSE datefrom END) || '<br/>au: ' || strftime('%d.%m.%Y', CASE WHEN dateto > DATE('"+ pconfig.year +"-12-31') THEN DATE('"+ pconfig.year +"-12-31') ELSE dateto END) ELSE strftime('%d.%m.%Y',datefrom) END AS planningdaterange," +
- //"case when datefrom!=dateto then strftime('%d.%m.%Y',case when datefrom < date('"+ pconfig.year +"-01-01') then 'de: ' date('"+ pconfig.year +"-01-01') else datefrom end) || '<br/>à: ' || strftime('%d.%m.%Y',case when dateto > date('"+ pconfig.year +"-12-31') then date('"+ pconfig.year +"-12-31') else dateto end) else strftime('%d.%m.%Y',datefrom) end as planningdaterange, " +
- "case when timefrom=timeto then '8h' when (cast(substr(timeto,1,2) as int) - cast(substr(timefrom,1,2) as int))= 4 then '4h' || case when timefrom!='00:00' then '<br/> à partir de ' || timefrom else '' end else (cast(substr(timeto,1,2) as int) - cast(substr(timefrom,1,2) as int)) || 'h' || case when timefrom!='00:00' then '<br/> à partir de ' || timefrom else '' end end as hourrange, "+
- "description, " +
- "case when type=0 then 'normal' when type=1 then 'exceptionnelle' when type=-1 then 'maladie' end as vacancytype,case when accepted='1' and type != -1 then '<span style=\"font-weight: bold; color: green;\">OUI</span>' else '<span style=\"font-weight: bold; color: red\">NON</span>' end as accepted FROM vacancycalendar where staffuuid='"+ pconfig.uuid +"' and (strftime('%Y',dateto)='"+ pconfig.year +"' or strftime('%Y',datefrom)='"+ pconfig.year +"');";
- //dump("XXSQL:" + vacdatasql + "\n");
-var vacdata = appdb.dbqueryarray(vacdatasql);
-
-
- $('#tbl_vacancy').html("");
- //$('#tbl_vacancy').append('<tfoot><tr><th></th><th colspan="4" style="text-align: center;"></th></tr></tfoot>');
- getlastyearsrest();
- calcvacancy();
- //vacdata.sqlhead.join(",") + "\n");
- var headerdata = getlabels(vacdata.sqlhead.join(","));
-
- $("#tbl_vacancy").dataTable({
- "language": {
- "url": "../../web/js/locale/datatable_fr.json"
- },
- "data": vacdata.sqldata,
- "columns": headerdata,
- "paging": false,
- "scrollY": wh + "px",
- "scrollCollapse": true,
- "ordering": true,
- "info": false,
- "filter": false,
- "destroy": true
- });
-
-}
-
-//function add_coworker() {
-// var newuuid = appdb.generate_uuid();
-// appdb.dbexec("insert into staff (uuid) VALUES ('" + newuuid + "');");
-// globelreq.send_request({
-// page: 'coworker',
-// data: {
-// "uuid": newuuid
-// },
-// header: 'HEADER TODO'
-// });
-//}
-
-function dlg_vacancy(uuid, type) {
- var evdata = {
- uuid: 0,
- description: '',
- vacdatefrom:new Date().toLocaleFormat("%d.%m.%Y"),
- vacdateto:new Date().toLocaleFormat("%d.%m.%Y"),
- staffuuid:pconfig.uuid,
- timefrom: '00:00',
- hours: '1',
- type:'0',
- dailyduration:'1.0'
- };
-
- if (type == 'upd') {
- var evsql = "SELECT uuid, strftime(\"%d.%m.%Y\",datefrom) as vacdatefrom, strftime(\"%d.%m.%Y\",dateto) as vacdateto, timefrom, description, '"+pconfig.uuid+"' as staffuuid,type, case when timefrom!=timeto then '0.' || (cast(substr(timeto,1,2) as int) - cast(substr(timefrom,1,2) as int)) else 1.0 end as dailyduration,null as hours,accepted FROM vacancycalendar where uuid='" + uuid.uuid + "';";
-
- evdata = appdb.dbquery(evsql);
- evdata = evdata.sqldata[0];
- if (evdata.type == -1){
- $("#btnacceptvacancy").hide();
- }else {
- $("#btnacceptvacancy").show();
- }
- if (evdata.dailyduration == '1') {
- evdata.dailyduration = '1.0';
- evdata.hours = '8';
- }else {
- evdata.hours = evdata.dailyduration.substring(2,3);
- if (evdata.dailyduration != '0.4') {
- evdata.dailyduration = '0.';
- }
- }
-
- }
-
- for (var w in evdata) {
- if ((w == 'datefrom') || (w == 'dateto')) {
- w='vac' + w;
- }
- //dump(w + "\n");
- if ($("#frmeditvacancy #" + w)) {
- $("#frmeditvacancy #" + w).val(evdata[w]);
- }
- }
- setdailydurationfields();
- $("#edit_vacancy").modal('show');
-}
-
-function confirm_delete_vacancy(uuid) {
- delvacation = uuid;
- $("#confirm_delete_vacancy").modal('show');
- return false;
-}
-
-function delete_vacancy() {
- var delsql = "DELETE FROM vacancycalendar where uuid='" + delvacation+"';";
- appdb.dbexec(delsql);
- load_table_vacancy();
- delvacancy=null;
- $("#confirm_delete_vacancy").modal('hide');
-
- return false;
-}
-
-function setdailydurationfields() {
- var dd = $('#dailyduration :selected').val();
- if (dd=='1.0') {
- $("#ftimefrom").hide();
- $("#fhours").hide();
- }else if (dd=='0.4') {
- $("#ftimefrom").show();
- $("#fhours").hide();
- }else if (dd=='0.') {
- $("#ftimefrom").show();
- $("#fhours").show();
- }
-}
-
-function save_vacancy() {
- var sql1 = new Array();
- var sql2 = new Array();
- var type = 'ins';
- var cuuid = "";
- if ($("#frmeditvacancy #uuid").val() != 0) {
- type = 'upd';
- cuuid = $("#frmeditvacancy #uuid").val();
- }
-
- $("#frmeditvacancy :input").each(function() {
- var input = $(this);
-
- if (input.attr("id")) {
-
- if (type == 'ins') {
-
-
- if (input.attr("id") == 'uuid') {
- sql1.push('"' + input.attr("id") + '"');
- if (input.val() == "" || input.val() == "0") {
- sql2.push("'" + appdb.generate_uuid() + "'");
- } else {
- sql2.push("'" + input.val() + "'");
- }
- } else if (input.attr("id") == 'dailyduration') {
- sql1.push('"timeto"');
- if (input.val() == '1.0') {
- sql2.push("'" +$('#timefrom').val() + "'");
- }else if (input.val() == '0.4') {
- var xval = parseInt($('#timefrom').val().substring(1,2)) + 4;
- if (xval < 10) { xval = "0" + xval;}
- xval += ":00";
- sql2.push("'" + xval + "'");
- }else {
- var xval = parseInt($('#timefrom').val().substring(1,2)) + parseInt($('#hours').val());
- if (xval < 10) { xval = "0" + xval;}
- xval += ":00";
- sql2.push("'" + xval + "'");
- }
- } else if ((input.attr("id") != 'dailyduration') && (input.attr("id") != 'hours')) {
- var xid = input.attr("id")
- if ((input.attr("id") == 'vacdatefrom') || (input.attr("id") == 'vacdateto')) {
-
- sql1.push('"' + input.attr("id").substring(3) + '"');
- }else {
- sql1.push('"' + input.attr("id") + '"');
- }
-
- var ival = encodeparam(input.val(), input.attr('type'));
- sql2.push(ival);
- }
- } else {
- if ((input.attr("id") != 'uuid') && (input.attr("id") != 'dailyduration') && (input.attr("id") != 'hours')) {
- var ival = encodeparam(input.val(), input.attr('type'));
- var xid =input.attr("id");
- if ((input.attr("id") == 'vacdatefrom') || (input.attr("id") == 'vacdateto')) {
- xid =input.attr("id").substring(3);
- }
- sql2.push('"' + xid + '"=' + ival);
- } else if (input.attr("id") == 'dailyduration') {
- if (input.val() == '1.0') {
- sql2.push('"timeto"='+ "'" + $('#timefrom').val() + "'");
- }else if (input.val() == '0.4') {
- var xval = parseInt($('#timefrom').val().substring(1,2)) + 4;
- if (xval < 10) { xval = "0" + xval;}
- xval += ":00";
- sql2.push('"timeto"=' +"'" + xval + "'");
- }else {
- var xval = parseInt($('#timefrom').val().substring(1,2)) + parseInt($('#hours').val());
- if (xval < 10) { xval = "0" + xval;}
- xval += ":00";
- sql2.push('"timeto"=' +"'" + xval + "'");
- }
- }
- }
-
- }
-
- });
-
- var xsql = "";
- if (type == 'upd') {
- xsql = "UPDATE vacancycalendar SET " + sql2.join(',') + " where \"uuid\"='" + cuuid + "';";
- } else {
-
- xsql = "INSERT INTO vacancycalendar (" + sql1.join(',') + ") VALUES (" + sql2.join(',') + ");";
- }
-
- appdb.dbexec(xsql);
- load_table_vacancy();
-
- $("#frmeditvacancy #uuid").val("0");
- $("#edit_vacancy").modal('hide');
-}
-
-
-function set_selectyears() {
-
- var years = appdb.dbquery("select strftime('%Y',coalesce(min(entrydate),date('now','-1 year'))) as minyear, strftime('%Y',date('now', '+1 year')) as maxyear from staff where uuid='"+pconfig.uuid+"';");
- var minyear = parseInt(years.sqldata[0].minyear);
- var maxyear = parseInt(years.sqldata[0].maxyear);
- for (var y=minyear;y<=maxyear;y++){
-
- var sel = "";
- if (y == pconfig.year) {
- sel=' selected="1" ';
-
- }
-
- $(".selyear").append("<option value=\""+y+"\""+sel+">"+y+"</option>");
- }
-
-}
-
-function calcvacancy() {
- //"Calc Vacancy Data!\n");
- var csel = "select days,hours from staffvacancydays where staffuuid='"+pconfig.uuid+"' and vacancyyear='"+pconfig.year+"';";
- //"SQL:"+ csel +"\n");
- var cnum = appdb.dbquery(csel);
-
- if (cnum.sqldata.length > 0) {
- if (pconfig.vacancyunit == "hours"){
- if ((!cnum.sqldata[0].hours) || (cnum.sqldata[0].hours === "")){
- cnum.sqldata[0].hours = cnum.sqldata[0].days * 8;
- }
- $('#vacancyyeartotal').val(cnum.sqldata[0].hours);
- }else{
- $('#vacancyyeartotal').val(cnum.sqldata[0].days);
- }
-
- }else {
- $('#vacancyyeartotal').val("");
- }
- var vdays = (($('#vacancyyeartotal').val() === "")?"":cnum.sqldata[0].days);
- var weekhours = $('#staff_weekhours').val();
- if (vdays === '') {
- $('#vacancystatus').html('<div class="alert alert-danger" style="padding: 2px;">Pas de jours de congés configuré pour l\'année '+ pconfig.year+'!</div>');
- return;
- }else if (weekhours === '') {
- $('#vacancystatus').html('<div class="alert alert-danger">Pas de heures par semaine configurées!</div>');
- return;
- }
-
- var vcalcsql = "select printf(\"%.2f\",(sum(dayhours) / ("+weekhours+"/5))) as days, SUM(dayhours) as hours,"+
- "taken,type,accepted from (" +
- "select vd.daydate,case when daydate <= date('now') then 1 else 0 end as taken,case when vc.timefrom=vc.timeto then cast ("+weekhours+"/5 as real) else (cast (substr(vc.timeto,1,2) as int) + (cast(substr(vc.timeto,4,5) as int)/60)) - (cast(substr(vc.timefrom,1,2) as int) + (cast(substr(vc.timeto,4,5) as int)/60)) end as dayhours,type,case when type != -1 then accepted else '1' end as accepted "+
- "from vacancycalendar vc left join ( "+
- "select daydate from ( ";
- var df = new Date(pconfig.year,0,1);
- var dt = new Date(pconfig.year,11,31);
- var yd = [];
- for (var dx=df;dx<=dt;dx.setDate(dx.getDate()+1)){
- yd.push("select date('"+dx.toLocaleFormat('%Y-%m-%d')+"') as daydate");
- }
- vcalcsql += yd.join(" UNION ") +
- ") yd where strftime('%w',daydate) not in ('0','6') and daydate not in (select vacancydate from vacancy where vacancydate between '"+pconfig.year+"-01-01' and '"+pconfig.year+"-12-31' and vacancydateto is null) " +
- ") vd on (vd.daydate between vc.datefrom and vc.dateto) " +
- "left join staffvacancydays svd on (vc.staffuuid=svd.staffuuid) " +
- "where vc.staffuuid='"+pconfig.uuid+ "' and daydate is not null group by daydate) group by type,taken,accepted;";
- //dump("SQL2:" + vcalcsql + "\n");
- var vcalc = appdb.dbquery(vcalcsql);
- vcalc = vcalc.sqldata;
- //dump(JSON.stringify(vcalc)+ "\n");
- vhours = vdays * 8;
- var vac = {};
- $("#lblyear").html(pconfig.year);
- vac.normal = {taken:{hours:0,days:0},open:{vhours:parseFloat(vhours), days:parseFloat(vdays)},accepted:{hours:0,days:0},asked:{hours:0,days:0}};
- vac.extra = {taken:{hours:0,days:0},open:{hours:0, days:0},accepted:{hours:0,days:0},asked:{hours:0,days:0}};
- vac.ill = {taken:{hours:0,days:0},open:{hours:0, days:0},accepted:{hours:0,days:0},asked:{hours:0,days:0}};
- vac.total = {taken:{hours:0,days:0},open:{hours:0, days:0},accepted:{hours:0,days:0},asked:{hours:0,days:0}};
- //dump(JSON.stringify(vac) + "\n");
- if (vcalc) {
- for (var c in vcalc){
- if (vcalc[c].type == '0' ){ //normal
- if (vcalc[c].taken == '1'){
- if (vcalc[c].accepted=='1'){
- vac.normal.taken.days = vac.normal.taken.days + parseFloat(vcalc[c].days);
- vac.normal.taken.hours = vac.normal.taken.hours + parseFloat(vcalc[c].hours);
- } else {
- vac.normal.asked.days = vac.normal.asked.days + parseFloat(vcalc[c].days);
- vac.normal.asked.hours = vac.normal.asked.hours + parseFloat(vcalc[c].hours);
- }
-
- } else if (vcalc[c].taken == '0') {
- if (vcalc[c].accepted=='1'){
- vac.normal.accepted.days = vac.normal.accepted.days + parseFloat(vcalc[c].days);
- vac.normal.accepted.hours = vac.normal.accepted.hours + parseFloat(vcalc[c].hours);
- } else {
- vac.normal.asked.days = vac.normal.asked.days + parseFloat(vcalc[c].days);
- vac.normal.asked.hours = vac.normal.asked.hours + parseFloat(vcalc[c].hours);
- }
-
- }
- vac.normal.open.days = parseFloat(vdays) - vac.normal.taken.days - vac.normal.accepted.days - vac.normal.asked.days;
- vac.normal.open.hours = parseFloat(vhours) - vac.normal.taken.hours - vac.normal.accepted.hours - vac.normal.asked.hours;
- //total
-
- } else if (vcalc[c].type == '1' ){ //extra
- if (vcalc[c].taken == '1'){
- if (vcalc[c].accepted=='1'){
- vac.extra.taken.days = vac.extra.taken.days + parseFloat(vcalc[c].days);
- vac.extra.taken.hours = vac.extra.taken.hours + parseFloat(vcalc[c].hours);
- } else {
- vac.extra.asked.days = vac.extra.asked.days + parseFloat(vcalc[c].days);
- vac.extra.asked.hours = vac.extra.asked.hours + parseFloat(vcalc[c].hours);
- }
- } else if (vcalc[c].taken == '0'){
- if (vcalc[c].accepted=='1'){
- vac.extra.accepted.days = vac.extra.accepted.days + parseFloat(vcalc[c].days);
- vac.extra.accepted.hours = vac.extra.accepted.hours + parseFloat(vcalc[c].hours);
- } else {
- vac.extra.asked.days = vac.extra.asked.days + parseFloat(vcalc[c].days);
- vac.extra.asked.hours = vac.extra.asked.hours + parseFloat(vcalc[c].hours);
- }
- }
- vac.extra.open.days = 0;
- vac.extra.open.hours = 0;
- } else if (vcalc[c].type == '-1' ){ //ill
- if (vcalc[c].taken == '1'){
- vac.ill.taken.days = vac.ill.taken.days + parseFloat(vcalc[c].days);
- vac.ill.taken.hours = vac.ill.taken.hours + parseFloat(vcalc[c].hours);
- } else if (vcalc[c].taken == '0'){
- if (vcalc[c].accepted=='1'){
- vac.ill.accepted.days = vac.ill.accepted.days + parseFloat(vcalc[c].days);
- vac.ill.accepted.hours = vac.ill.accepted.hours + parseFloat(vcalc[c].hours);
- } else {
- vac.ill.asked.days = vac.ill.asked.days + parseFloat(vcalc[c].days);
- vac.ill.asked.hours = vac.ill.asked.hours + parseFloat(vcalc[c].hours);
- }
- }
- vac.ill.open.days = 0;
- vac.ill.open.hours = 0;
-
- }
- vac.total.taken.days = vac.normal.taken.days + vac.extra.taken.days + vac.ill.taken.days;
- vac.total.taken.hours = vac.normal.taken.hours + vac.extra.taken.hours + vac.ill.taken.hours;
- vac.total.open.days = vac.normal.open.days + vac.extra.open.days + vac.ill.open.days;
- vac.total.open.hours = vac.normal.open.hours + vac.extra.open.hours + vac.ill.open.hours;
- vac.total.accepted.days = vac.normal.accepted.days + vac.extra.accepted.days + vac.ill.accepted.days;
- vac.total.accepted.hours = vac.normal.accepted.hours + vac.extra.accepted.hours + vac.ill.accepted.hours;
- vac.total.asked.days = vac.normal.asked.days + vac.extra.asked.days + vac.ill.asked.days;
- vac.total.asked.hours = vac.normal.asked.hours + vac.extra.asked.hours + vac.ill.asked.hours;
- }
- //JSON.stringify(vac) + "\n");
- if (pconfig.vacancyunit == 'days'){
- $("#vacnopen").html(((vac.normal.open.days && vac.normal.open.days != 0)?vac.normal.open.days.toFixed(2)+" j":" "));
- $("#vacntaken").html(vac.normal.taken.days.toFixed(2)+" j");
- $("#vacnasked").html(vac.normal.asked.days.toFixed(2)+" j");
- $("#vacnplanned").html(vac.normal.accepted.days.toFixed(2)+" j");
-
- $("#vaceopen").html(" ");
- $("#vacetaken").html(vac.extra.taken.days.toFixed(2)+" j");
- $("#vaceasked").html(vac.extra.asked.days.toFixed(2)+" j");
- $("#vaceplanned").html(vac.extra.accepted.days.toFixed(2)+" j");
-
- $("#vacmopen").html(" ");
- $("#vacmtaken").html(vac.ill.taken.days.toFixed(2)+" j");
- $("#vacmasked").html(vac.ill.asked.days.toFixed(2)+" j");
- $("#vacmplanned").html(vac.ill.accepted.days.toFixed(2)+" j");
-
- $("#vactopen").html(vac.total.open.days.toFixed(2)+" j");
- $("#vacttaken").html(vac.total.taken.days.toFixed(2)+" j");
- $("#vactasked").html(vac.total.asked.days.toFixed(2)+" j");
- $("#vactplanned").html(vac.total.accepted.days.toFixed(2)+" j");
- } else {
- vac.normal.open.hours=vac.normal.open.hours + parseInt($("#vacancylastyearrest").val());
- $("#vacnopen").html(((vac.normal.open.hours && vac.normal.open.hours != 0)?vac.normal.open.hours+" h":" "));
- $("#vacntaken").html(((vac.normal.taken.hours && vac.normal.taken.hours > 0)?vac.normal.taken.hours+" h":" "));
- $("#vacnasked").html(((vac.normal.asked.hours && vac.normal.asked.hours > 0)?vac.normal.asked.hours+" h":" "));
- $("#vacnplanned").html(((vac.normal.accepted.hours && vac.normal.accepted.hours > 0)?vac.normal.accepted.hours+" h":" "));
-
- $("#vacetaken").html(((vac.extra.taken.hours && vac.extra.taken.hours > 0)?vac.extra.taken.hours+" h":" "));
- $("#vaceasked").html(((vac.extra.asked.hours && vac.extra.asked.hours > 0)?vac.extra.asked.hours+" h":" "));
- $("#vaceplanned").html(((vac.extra.accepted.hours && vac.extra.accepted.hours > 0)?vac.extra.accepted.hours+" h":" "));
-
- $("#vacmtaken").html(((vac.ill.taken.hours && vac.ill.taken.hours > 0)?vac.ill.taken.hours+" h":" "));
- $("#vacmasked").html(((vac.ill.asked.hours && vac.ill.asked.hours > 0)?vac.ill.asked.hours+" h":" "));
- $("#vacmplanned").html(((vac.ill.accepted.hours && vac.ill.accepted.hours > 0)?vac.ill.accepted.hours+" h":" "));
-
- $("#vactopen").html(((vac.total.open.hours && vac.total.open.hours > 0)?vac.total.open.hours+" h":" "));
- $("#vacttaken").html(((vac.total.taken.hours && vac.total.taken.hours > 0)?vac.total.taken.hours+" h":" "));
- $("#vactasked").html(((vac.total.asked.hours && vac.total.asked.hours > 0)?vac.total.asked.hours+" h":" "));
- $("#vactplanned").html(((vac.total.accepted.hours && vac.total.accepted.hours > 0)?vac.total.accepted.hours+" h":" "));
-
- }
-
- //dump(JSON.stringify(vac) + " - Set data vacancy status\n");
- // var hdata = " <span style=\"font-weight: normal;\"><span style=\"text-decoration: underline;\">pris:</span> <strong>"+ vac.taken.hours +" h</strong> ("+ vac.taken.days.toFixed(2)+" jour(s)) - ";
- // hdata += " <span style=\"text-decoration: underline;\">planifié:</span> <strong>"+ vac.rest.hours+" h</strong> ("+ vac.rest.days.toFixed(2)+" jour(s)) - ";
- // hdata += " <span style=\"text-decoration: underline;\">ouvert:</span> <strong>"+ vac.open.hours +" h</strong> ("+ vac.open.days.toFixed(2)+" jour(s))";
- // if (vac.ill > 0) {
- // hdata += " - (<span style=\"text-decoration: underline;\">maladie:</span> <strong>"+ vac.ill.hours+" h</strong> ("+ vac.ill.days.toFixed(2)+" jour(s)))</span>";
- // }
- //dump("HTML: --" + document.getElementById("vacancystatus").innerHTML +"//\n->" + hdata + "\n");
- //$("#vacancystatus").html("");
- //if ($("#vacancystatus")){
- //dump("vacancystatus exists\n");
- //
- //}
- $("#vacancystatus").html("");
- }
- else {
- $("#vacancystatus").html("");
- }
- }
-
-
-function setvacancyunit(){
- var vacunit = $('#vacancy_unit').val();
- if ($('#vacancyyeartotal').val() !== ""){
- var vacval = parseFloat($('#vacancyyeartotal').val().replace(',','.'));
- if (((!pconfig.vacancyunit) || (pconfig.vacancyunit == 'days')) && (vacunit == 'hours')){
- $('#vacancyyeartotal').val(vacval * 8);
- }else if (pconfig.vacancyunit != vacunit){
- $('#vacancyyeartotal').val(vacval / 8);
- }
- }
- //dump("vacunit: " + vacunit + "\n");
- pconfig.vacancyunit = vacunit;
- apppref.setpreference("pageconfig.coworker",pconfig);
-}
-
-function setfreq() {
-
- curfreq.freq = $('#freq option:selected').val();
-
- $('#freqinterval').hide();
- $('#freqmonthly').hide();
- $('#freqweekly').hide();
- if (curfreq.freq != "") {
-
- $('#lblfreq').text(lblfreq[curfreq.freq]);
- $('#freqinterval').show();
- if (curfreq.freq != 'daily') {
- $('#freq' + curfreq.freq).show();
- }
- }
-
-}
-
-function getlastyearsrest(){
- var weekhours = $('#staff_weekhours').val();
- if (weekhours === '') {
- $("#vacancylastyearrest").val(0);
- return;
- }
- var df = new Date(pconfig.year-1,0,1);
- var dt = new Date(pconfig.year-1,11,31);
- var vcalcrestsql = "select (select hours from staffvacancydays where staffuuid='"+pconfig.uuid+ "' and vacancyyear="+df.getFullYear()+")-SUM(dayhours) AS hours from (" +
- "select vd.daydate,case when daydate <= date('now') then 1 else 0 end as taken,case when vc.timefrom=vc.timeto then cast ("+weekhours+"/5 as real) else (cast (substr(vc.timeto,1,2) as int) + (cast(substr(vc.timeto,4,5) as int)/60)) - (cast(substr(vc.timefrom,1,2) as int) + (cast(substr(vc.timeto,4,5) as int)/60)) end as dayhours,type,case when type != -1 then accepted else '1' end as accepted "+
- "from vacancycalendar vc left join ( "+
- "select daydate from ( ";
-
- var yd = [];
- for (var dx=df;dx<=dt;dx.setDate(dx.getDate()+1)){
- yd.push("select date('"+dx.toLocaleFormat('%Y-%m-%d')+"') as daydate");
- }
- vcalcrestsql += yd.join(" UNION ") +
- ") yd where strftime('%w',daydate) not in ('0','6') and daydate not in (select vacancydate from vacancy where vacancydate between '"+df.getFullYear()+"-01-01' and '"+dt.getFullYear()+"-12-31' and vacancydateto is null) " +
- ") vd on (vd.daydate between vc.datefrom and vc.dateto) " +
- "left join staffvacancydays svd on (vc.staffuuid=svd.staffuuid) " +
- "where vc.staffuuid='"+pconfig.uuid+ "' and daydate is not null group by daydate) where type in (0,1) and taken=1 and accepted=1 group by taken,accepted;";
- //dump("SQLREST:" + vcalcrestsql + "\n");
- var vcalc = appdb.dbquery(vcalcrestsql);
- //dump(JSON.stringify(vcalc) + "\n");
- if (vcalc && vcalc.sqldata[0]){
-
- $("#vacancylastyearrest").val(vcalc.sqldata[0].hours);
- }else {
- $("#vacancylastyearrest").val(0);
- }
- return;
-}
-
+++ /dev/null
-//Source-code licensed under EUPL v1.1 ( Copyright 2016 By DKS s.à r.l. - Kilian Saffran - Luxembourg )
-var pconfig = {};
-var delcoworker = null;
-var wh = window.innerHeight - 100;
-var tblstaff = null;
-
-function initdata() {
-
- loadtable();
- set_infoheader("");
- if (!pconfig.printlayout) {
- pconfig.printlayout = 'list';
- apppref.setpreference("pageconfig.staff", pconfig);
- }
- }
-
-function loadtable() {
- var sql = "SELECT '<button type=\"button\" class=\"btn btn-primary\" onclick=\"load_coworker(''' || uuid || ''')\" title=\"editer\"><span class=\"glyphicon glyphicon-pencil\"></span></button> <button type=\"button\" class=\"btn btn-danger\" onclick=\"confirm_delete_coworker(''' || uuid || ''');\" title=\"supprimer\"><span class=\"glyphicon glyphicon-remove\"></span></button> ' as action, coalesce(prename,'') || '<br/>' || coalesce(surname,'') as name,case when color is not null then '<div style=\"width: 50px; height: 30px;background-color: ' || color ||';\"></div>' else null end color, coalesce(address,'')|| '<br/>' || coalesce(zip,'') || ' ' || coalesce(city,'') || '<br/>' || coalesce(country,'') as address, case when phone is not null then '<span class=\"glyphicon glyphicon-earphone\" aria-hidden=\"true\"></span>: ' || phone || '<br/>' else '' end || case when email is not null then '<span class=\"glyphicon glyphicon-envelope\" aria-hidden=\"true\"></span>:' || email else '' end as phonemail, coalesce(jobtitle,'') || '<br/>' || case when entrydate is not null then 'à partir du: ' || strftime('%d.%m.%Y',entrydate) else '' end || case when exitdate is not null then ' jusqu''au: ' || strftime('%d.%m.%Y',exitdate) else '' end as jobtitle FROM staff;";
- //dump("STAFFSQL:" +sql + "\n");
- var data = appdb.dbqueryarray(sql);
-
- var headerdata = getlabels(data.sqlhead.join(","));
- $("#tbl_staff").html("");
- tblstaff = $("#tbl_staff").dataTable({
- "language": {
- "url": "../../web/js/locale/datatable_fr.json"
- },
- "data": data.sqldata,
- "columns": headerdata,
- "paging": false,
- "scrollY": wh + "px",
- "scrollCollapse": true,
- "ordering": true,
- "info": false,
- "filter": true,
- "destroy": true
- });
-// $('#tbl_staff').on('search.dt', function() {
-// pconfig.filter = tblstaff.api().search();
-// apppref.setpreference("pageconfig.staff", pconfig);
-// });
-
- $('#tbl_staff').on('order.dt', function() {
- pconfig.order = tblstaff.fnSettings().aaSorting;
- apppref.setpreference("pageconfig.staff", pconfig);
-
- });
-// if (pconfig.filter) {
-// tblstaff.fnFilter(pconfig.filter);
-// }
- if (pconfig.order) {
- tblstaff.fnSort(pconfig.order);
- }
- if (/*(!pconfig.filter) && */ (!pconfig.order)) {
- tblstaff.fnDraw();
- }
-}
-
-
-
-function add_coworker() {
- var newuuid = appdb.generate_uuid();
- appdb.dbexec("insert into staff (uuid) VALUES ('" + newuuid + "');");
-
- globelreq.send_request({
- page: 'coworker',
- module: 'staff',
- data: {
- "uuid": newuuid
- },
- header: 'Employé(e)'
- });
-}
-
-function confirm_delete_coworker(myuuid) {
- //alert('TEST');
- delcoworker = myuuid;
- $("#confirm_delete_coworker").modal('show');
- return false;
-}
-
-function delete_coworker() {
- //var frmdata = new Object();
- //appdb.dbexec("DELETE FROM planningstaff where staffuuid='"+delcoworker +"';");
- var evdel = appdb.dbquery("select eventcalendaruuid,count(staffuuid) as cnt from staffplanning where staffuuid='" + delcoworker + "';");
-
- appdb.dbexec("DELETE FROM staffvacancydays where staffuuid='" + delcoworker + "';");
- appdb.dbexec("DELETE FROM vacancycalendar where staffuuid='" + delcoworker + "';");
- appdb.dbexec("DELETE FROM staffplanning where staffuuid='" + delcoworker + "';");
- appdb.dbexec("DELETE FROM staff where uuid='" + delcoworker + "';");
- for (var e in evdel.sqldata) {
- if (evdel.sqldata[e].cnt == 1) {
- appdb.dbexec("DELETE FROM eventcalendar where uuid='" + evdel.sqldata[e].eventcalendaruuid + "';");
- }
- }
- //
- delcoworker = null;
- loadtable();
- //
- $("#confirm_delete_coworker").modal('hide');
-
-}
-
-function load_coworker(couuid){
- //"coworker uuid:" + couuid + "\n");
- var cwdata = apppref.getpreference("pageconfig.coworker");
- var cow = new Object();
- if (cwdata && cwdata !== ""){
- cow = JSON.parse(cwdata);
- }
- //dump("Current CoWorker cfg:" +JSON.stringify(cow) + "\n");
- cow.uuid = couuid;
- //dump("New CoWorker cfg:" +JSON.stringify(cow) + "\n");
- apppref.setpreference("pageconfig.coworker",cow);
- globelreq.send_request({page:'coworker',
- module:'staff',
- data:null,
- header:'Employé(e)'});
-
-}
\ No newline at end of file
+++ /dev/null
-//Source-code licensed under EUPL v1.1 ( Copyright 2016 By DKS s.à r.l. - Kilian Saffran - Luxembourg )
-var pconfig = {};
-var wh = window.innerHeight - 100;
-
-function initdata() {
- set_infoheader("");
- if (!pconfig.printlayout) {
- pconfig.printlayout = 'list';
- apppref.setpreference("pageconfig.staff", pconfig);
- }
- load_staff_selection();
- var stlist = appdb.dbquery("select * from creche;");
- //dump(JSON.stringify(stlist) + "\n");
- if ((stlist.sqldata) && stlist.sqldata[0].stafflist == '1'){
- $("#stafflist").show();
- loadtable_staff();
- $("#stafflogin").hide();
- }
-}
-
-function loadtable_staff() {
- var sql = "SELECT '<button type=\"button\" class=\"btn btn-primary\" onclick=\"load_coworker(''' || uuid || ''');\" title=\"editer\"><span class=\"glyphicon glyphicon-pencil\"></span></button> <button type=\"button\" class=\"btn btn-danger\" onclick=\"confirm_delete_coworker(''' || uuid || ''');\" title=\"supprimer\"><span class=\"glyphicon glyphicon-remove\"></span></button> ' as action, coalesce(prename,'') || '<br/>' || coalesce(surname,'') as name,case when color is not null then '<div style=\"width: 50px; height: 30px;background-color: ' || color ||';\"></div>' else null end color, coalesce(address,'')|| '<br/>' || coalesce(zip,'') || ' ' || coalesce(city,'') || '<br/>' || coalesce(country,'') as address, case when phone is not null then '<span class=\"glyphicon glyphicon-earphone\" aria-hidden=\"true\"></span>: ' || phone || '<br/>' else '' end || case when email is not null then '<span class=\"glyphicon glyphicon-envelope\" aria-hidden=\"true\"></span>:' || email else '' end as phonemail, coalesce(jobtitle,'') || '<br/>' || case when entrydate is not null then 'à partir du: ' || strftime('%d.%m.%Y',entrydate) else '' end || case when exitdate is not null then ' jusqu''au: ' || strftime('%d.%m.%Y',exitdate) else '' end as jobtitle FROM staff;";
- //dump(sql + "\n");
- var data = appdb.dbqueryarray(sql);
-
- var headerdata = getlabels(data.sqlhead.join(","));
- $("#tbl_staff").html("");
- tblstaff = $("#tbl_staff").dataTable({
- "language": {
- "url": "../../web/js/locale/datatable_fr.json"
- },
- "data": data.sqldata,
- "columns": headerdata,
- "paging": false,
- "scrollY": wh + "px",
- "scrollCollapse": true,
- "ordering": true,
- "info": false,
- "filter": true,
- "destroy": true
- });
-// $('#tbl_staff').on('search.dt', function() {
-// pconfig.filter = tblstaff.api().search();
-// apppref.setpreference("pageconfig.staff", pconfig);
-// });
-
- $('#tbl_staff').on('order.dt', function() {
- pconfig.order = tblstaff.fnSettings().aaSorting;
- apppref.setpreference("pageconfig.staff", pconfig);
-
- });
-// if (pconfig.filter) {
-// tblstaff.fnFilter(pconfig.filter);
-// }
- if (pconfig.order) {
- tblstaff.fnSort(pconfig.order);
- }
- if (/*(!pconfig.filter) && */ (!pconfig.order)) {
- tblstaff.fnDraw();
- }
- }
-
-function load_coworker_basic(){
- var couuid= $('#sel_staff :selected').val();
- var copwd = $('#txtpasswd').val();
- var encpwd = MD5(copwd);
- var cwpwd = appdb.dbquery("select password from staff where uuid='"+couuid+"';");
- //dump(cwpwd + "\n");
- //dump("SQL: select password from staff where uuid='"+couuid+"';\n");
- //dump("PWD: " + copwd + " ENC: " + encpwd + " CMP: "+ cwpwd.sqldata[0].password +"\n");
- if (cwpwd.sqldata[0].password == encpwd){
- var cwdata = apppref.getpreference("pageconfig.coworker");
- var cow = new Object();
- if (cwdata && cwdata !== ""){
- cow = JSON.parse(cwdata);
- }
- cow.uuid = couuid;
- //dump("New CoWorker cfg:" +JSON.stringify(cow) + "\n");
- apppref.setpreference("pageconfig.coworker",cow);
- globelreq.send_request({page:'coworker_basic',
- module:'staff',
- data:null,
- header:'Employé(e)'});
-
- }
-
-
-}
-
-function load_coworker(couuid){
- //"coworker uuid:" + couuid + "\n");
- var cwdata = apppref.getpreference("pageconfig.coworker");
- var cow = new Object();
- if (cwdata && cwdata !== ""){
- cow = JSON.parse(cwdata);
- }
- //dump("Current CoWorker cfg:" +JSON.stringify(cow) + "\n");
- cow.uuid = couuid;
- //dump("New CoWorker cfg:" +JSON.stringify(cow) + "\n");
- apppref.setpreference("pageconfig.coworker",cow);
- globelreq.send_request({page:'coworker_basic',
- module:'staff',
- data:null,
- header:'Employé(e)'});
-
- }
-
-function load_staff_selection(){
- var stdata = appdb.dbquery("select uuid, coalesce(surname,'') || ' ' || coalesce(prename,'') as name,case when color is null then '#000' else color end as color from staff where password is not null order by surname,prename");
- stdata = stdata.sqldata;
- //JSON.stringify(stdata));
- for (var s in stdata){
- $('#sel_staff').append('<option value="'+ stdata[s].uuid+'">' +stdata[s].name+ '</option>');
- }
-}
-
-function onselstaff(objid) {
-
- //pconfig.filterstaff = $('#' + objid).val();
- //apppref.setpreference("pageconfig.calactivity",pconfig);
- //load_calendar_data();
-}
\ No newline at end of file
+++ /dev/null
-<!DOCTYPE html>
-
-<html lang="fr">
-<head>
- <meta charset="utf-8">
-
- <title>Creorga - Staff</title>
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <meta http-equiv="cache-control" content="max-age=0" />
- <meta http-equiv="cache-control" content="no-cache" />
- <meta http-equiv="expires" content="0" />
- <meta http-equiv="expires" content="Tue, 01 Jan 1970 1:00:00 GMT" />
- <meta http-equiv="pragma" content="no-cache" />
- <link href="../../web/css/bootstrap.min.css" rel="stylesheet" type="text/css">
- <!--<link href="../../web/css/bootstrap-theme.min.css" rel="stylesheet" type="text/css">-->
- <link href="../../web/css/datatables.min.css" rel="stylesheet" type="text/css">
- <link href="../../web/css/dataTables.bootstrap.min.css" rel="stylesheet" type="text/css">
- <link href="../../web/css/glyphicons.css" rel="stylesheet" type="text/css">
- <link href="../../web/css/style.css" rel="stylesheet" type="text/css">
- <link href="../../web/css/creorga.css" rel="stylesheet" type="text/css"><!-- Fav and touch icons -->
-
- <link rel="shortcut icon" href="img/favicon.png">
-</head>
-
-<body>
- <div class="container-fluid" style="padding-top: 5px;">
- <!--<span class="pagehead" id="pagehead">Personnel</span> -->
- <div class="btn-group" style="z-index: 10;">
- <button onclick="add_coworker();" class="btn btn-primary" type="button" >
- <span class="glyphicon glyphicon-plus"></span>
-</button>
- </div>
- <div style="margin-top: -30px;z-index: -10;">
- <table id="tbl_staff" class="table table-striped">
- </table>
- </div>
- <div class="modal fade" id="confirm_delete_coworker">
- <div class="modal-dialog">
- <div class="modal-content">
- <div class="modal-header">
- <button data-dismiss="modal" class="close" type="button"><span aria-hidden="true">x</span><span class="sr-only">Close</span></button>
-
- <h4 class="modal-title">Supprimer un collaborateur</h4>
- </div><!-- dialog contents -->
-
- <div class="modal-body">
- Êtes vous sûre de supprimer ce collaborateur et tous ces données?<br>
- </div><!-- dialog buttons -->
-
- <div class="modal-footer">
- <button aria-hidden="true" data-dismiss="modal" class="btn">Non</button> <button onclick="delete_coworker();" class="btn btn-primary">Oui</button>
- </div>
- </div>
- </div>
- </div>
- </div>
-
- <script src="../../web/js/jquery.min.js" type="text/javascript"></script>
- <script src="../../web/js/bootstrap.min.js" type="text/javascript"></script>
- <script src="../../web/js/datatables.min.js" type="text/javascript"></script>
- <script src="chrome://creorga/content/js/navigation.js" type="text/javascript"></script>
- <script src="chrome://creorga/content/js/preferences.js" type="text/javascript"></script>
- <script src="chrome://creorga/content/js/database.js" type="text/javascript"></script>
- <script src="chrome://creorga/content/js/system.js" type="text/javascript"></script>
- <script src="../../web/js/creorga.js" type="text/javascript"></script>
- <script src="../../web/js/labels.js" type="text/javascript"></script>
- <script src="js/staff.js" type="text/javascript"></script>
-</body>
-</html>
+++ /dev/null
-<?xml version="1.0"?>
-<!DOCTYPE overlay PUBLIC "-//MOZILLA//DTD XUL V1.0//EN"
-"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
-<overlay id="ov_staff" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:html="http://www.w3.org/1999/xhtml">
- <toolbar id="co_maintoolbar" style="-moz-appearance: none;">
- <toolbarbutton class="btn btn-default" id="tbb_staff" insertafter="tbb_presences" label="Personnel" image="modules/staff/img/staff.png" orient="vertical" oncommand="navigation.load_appview('staff','staff',null,'Liste du Personnel');"/>
- </toolbar>
-</overlay>
\ No newline at end of file
+++ /dev/null
-<!DOCTYPE html>
-
-<html lang="fr">
-<head>
- <meta charset="utf-8">
-
- <title>Creorga - Staff Basic</title>
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <meta http-equiv="cache-control" content="max-age=0" />
- <meta http-equiv="cache-control" content="no-cache" />
- <meta http-equiv="expires" content="0" />
- <meta http-equiv="expires" content="Tue, 01 Jan 1970 1:00:00 GMT" />
- <meta http-equiv="pragma" content="no-cache" />
- <link href="../../web/css/bootstrap.min.css" rel="stylesheet" type="text/css">
- <!--<link href="../../web/css/bootstrap-theme.min.css" rel="stylesheet" type="text/css">-->
- <link href="../../web/css/datatables.min.css" rel="stylesheet" type="text/css">
- <link href="../../web/css/dataTables.bootstrap.min.css" rel="stylesheet" type="text/css">
- <link href="../../web/css/glyphicons.css" rel="stylesheet" type="text/css">
- <link href="../../web/css/style.css" rel="stylesheet" type="text/css">
- <link href="../../web/css/creorga.css" rel="stylesheet" type="text/css"><!-- Fav and touch icons -->
-
- <link rel="shortcut icon" href="img/favicon.png">
-</head>
-
-<body>
- <div class="container-fluid" style="padding-top: 5px;">
- <div style="margin-top: -30px;z-index: -10; display: none" id="stafflist">
- <table id="tbl_staff" class="table table-striped">
- </table>
- </div>
- <div class="container col-xs-12 col-sm-offset-2 col-sm-8 col-md-offset-3 col-md-6 col-lg-offset-4 col-lg-4" id="stafflogin">
- <br />
- <div class="panel panel-default">
- <div class="panel-heading">
- <h1>Login</h1>
- </div>
- <div class="panel-body">
- <div class="form-group">
- <div class="input-group">
- <span class="input-group-addon">
- <span class="glyphicon glyphicon-user"></span>
- </span>
- <select id="sel_staff" onchange="onselstaff(this.id);" style="width: 100%">
-
- </select>
-
- </div>
- </div>
- <div class="form-group">
- <div class="input-group">
- <span class="input-group-addon">
- <span class="glyphicon glyphicon-lock"></span>
- </span>
- <input id="txtpasswd" type="password" class="form-control" />
- </div>
- </div>
- <button id="btnLogin" class="btn btn-primary" style="width: 100%" onclick="load_coworker_basic();">
- <span class="glyphicon glyphicon-log-in"></span> Entrez
- </button>
- </div>
- </div>
- </div>
- </div>
-
- <script src="../../web/js/jquery.min.js" type="text/javascript"></script>
- <script src="../../web/js/bootstrap.min.js" type="text/javascript"></script>
- <script src="../../web/js/datatables.min.js" type="text/javascript"></script>
- <script src="chrome://creorga/content/js/encrypt.js" type="text/javascript"></script>
- <script src="chrome://creorga/content/js/navigation.js" type="text/javascript"></script>
- <script src="chrome://creorga/content/js/preferences.js" type="text/javascript"></script>
- <script src="chrome://creorga/content/js/database.js" type="text/javascript"></script>
- <script src="chrome://creorga/content/js/system.js" type="text/javascript"></script>
- <script src="../../web/js/creorga.js" type="text/javascript"></script>
- <script src="../../web/js/labels.js" type="text/javascript"></script>
- <script src="js/staff_basic.js" type="text/javascript"></script>
-</body>
-</html>
+++ /dev/null
-<?xml version="1.0"?>
-<!DOCTYPE overlay PUBLIC "-//MOZILLA//DTD XUL V1.0//EN"
-"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
-<overlay id="ov_staffbasic" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:html="http://www.w3.org/1999/xhtml">
- <toolbar id="co_maintoolbar" style="-moz-appearance: none;">
- <toolbarbutton class="btn btn-default" id="tbb_staff" insertafter="tbb_presences" label="Personnel" image="modules/staff/img/staff.png" orient="vertical" oncommand="navigation.load_appview('staff_basic','staff',null,'Espace Personnel');"/>
- </toolbar>
-</overlay>
\ No newline at end of file
+++ /dev/null
-<!DOCTYPE html>
-
-<html lang="fr">
-<head>
- <meta charset="utf-8">
- <title>Liste d'attente</title>
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <meta http-equiv="cache-control" content="max-age=0" />
- <meta http-equiv="cache-control" content="no-cache" />
- <meta http-equiv="expires" content="0" />
- <meta http-equiv="expires" content="Tue, 01 Jan 1970 1:00:00 GMT" />
- <meta http-equiv="pragma" content="no-cache" />
- <link href="css/bootstrap.min.css" rel="stylesheet" type="text/css">
- <!--<link href="css/bootstrap-theme.min.css" rel="stylesheet" type="text/css">-->
- <link href="css/datatables.min.css" rel="stylesheet" type="text/css">
- <link href="css/dataTables.bootstrap.min.css" rel="stylesheet" type="text/css">
- <link href="css/bootstrap-datetimepicker.min.css" rel="stylesheet" type="text/css">
- <!-- <link href="css/bootstrap-timepicker.min.css" rel="stylesheet" type="text/css"> -->
- <link href="css/glyphicons.css" rel="stylesheet" type="text/css">
- <link href="css/summernote.css" rel="stylesheet" type="text/css">
- <link href="css/creorga.css" rel="stylesheet" type="text/css"><!-- Fav and touch icons -->
-</head>
-
-<body>
-
- <div class="container-fluid" style="padding-top: 5px;"><div id="main" class="main">
- <!--<span class="pagehead" id="pagehead">Liste d'attente</span> -->
- <div class="btn-group" style="z-index: 10;">
- <button onclick="dlg_waitlist({'uuid':''},'ins');" class="btn btn-primary" type="button"><span class="glyphicon glyphicon-plus" aria-hidden="true"></span></button>
- <!--<button onclick="print_list();" class="btn btn-primary" type="button" id="btnprintwaitlist"><span class="glyphicon glyphicon-print" aria-hidden="true"></span></button>-->
- </div>
- <div style="margin-top: -30px;z-index: -10;">
- <!--<div id="tbl_waitlist_wrapper" class="dataTables_wrapper" >-->
- <table class="display compact dataTable" width="100%" style="width: 100%;" id="tbl_waitlist" role="grid"></table>
- <!--</div>-->
- </div>
-</div>
- <div class="modal fade" id="edit_waitlist">
- <div class="modal-dialog" style="width: 800px; min-width: 800px;">
- <div class="modal-content">
- <div class="modal-header">
- <button data-dismiss="modal" class="close" type="button"><span aria-hidden="true">x</span><span class="sr-only">Close</span></button>
- <h4 class="modal-title">Editer/Ajouter contact</h4>
- </div>
- <div class="modal-body" style=" height: 600px; max-height: 600px ">
-
- <div id="frmeditwaitlist">
- <input type="hidden" value="0" id="uuid" />
-
- <div class="form-group" id="date-container">
- <label for="datestart">date de contacte</label>
- <div id="dt_waitdate" class="input-group date">
- <input type="date" class="form-control" value="" limits="0" placeholder="dd.mm.yyyy" id="waitdate"><span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
- </div>
- </div>
- <div class="form-group">
- <label for="name">Nom</label>
- <input type="text" value="" id="name" nullable="true" class="form-control">
- </div>
- <div class="row col-md-12">
- <div class="form-group col-md-4">
- <label for="phone">Téléphone</label>
- <input type="text" value="" id="phone" nullable="true" class="form-control">
- </div>
- <div class="form-group col-md-4">
- <label for="email">E-Mail</label>
- <input type="text" value="" id="email" nullable="true" class="form-control">
- </div>
- <div class="form-group col-md-4">
- <label for="age">Âge</label>
- <input type="text" value="" id="age" nullable="true" class="form-control">
- </div>
- </div>
- <div class="form-group">
- <label for="note">Remarque</label>
- <textarea class="summernote" type="text" id="note"></textarea>
- </div>
- </div>
- </div>
- <div class="modal-footer">
- <button aria-hidden="true" data-dismiss="modal" class="btn">Annuler</button> <button onclick="save_waitlist();" class="btn btn-primary">OK</button>
- </div>
- </div>
-
-
- </div>
- </div>
-
-
- <div class="modal fade" id="confirm_delete_waitlist">
- <div class="modal-dialog">
- <div class="modal-content">
- <div class="modal-header">
- <button data-dismiss="modal" class="close" type="button"><span aria-hidden="true">x</span><span class="sr-only">Close</span></button>
-
- <h4 class="modal-title">Supprimer</h4>
- </div><!-- dialog contents -->
-
- <div class="modal-body">
- Êtes vous sûre de supprimer ce contact?
-
-
- </div><!-- dialog buttons -->
-
- <div class="modal-footer">
- <button aria-hidden="true" data-dismiss="modal" class="btn">Non</button> <button onclick="delete_waitlist();" class="btn btn-primary">Oui</button>
- </div>
- </div>
- </div>
- </div>
- </div>
- <script src="js/jquery.min.js" type="text/javascript"></script>
- <script src="js/bootstrap.min.js" type="text/javascript"></script>
- <script src="js/datatables.min.js" type="text/javascript"></script>
- <script src="js/moment-with-locales.js" type="text/javascript"></script>
- <script src="js/bootstrap-datetimepicker.min.js" type="text/javascript"></script>
- <!-- <script src="js/bootstrap-timepicker.min.js" type="text/javascript"></script> -->
- <script src="js/summernote.min.js" type="text/javascript"></script>
- <script src="js/lang/summernote-fr-FR.min.js" type="text/javascript"></script>
- <script src="chrome://creorga/content/js/navigation.js" type="text/javascript"></script>
- <script src="chrome://creorga/content/js/system.js" type="text/javascript"></script>
- <script src="chrome://creorga/content/js/preferences.js" type="text/javascript"></script>
- <script src="chrome://creorga/content/js/database.js" type="text/javascript"></script>
- <script src="chrome://creorga/content/js/tools.js" type="text/javascript"></script>
- <script src="js/labels.js" type="text/javascript"></script>
- <script src="js/waitlist.js" type="text/javascript"></script>
- <script src="js/creorga.js" type="text/javascript"></script>
-
-</body>
-</html>
\ No newline at end of file
+++ /dev/null
-//Source-code licensed under EUPL v1.1 ( Copyright 2016 By DKS s.à r.l. - Kilian Saffran - Luxembourg )
-
-var pconfig = {};
-var wh= window.innerHeight-130;
-var delwl = null;
-var tblwaitlist = null;
-
-function initdata(){
- load_helpers();
- var pdata = apppref.getpreference("pageconfig.waitlist");
- if (pdata != '') {
- pconfig = JSON.parse(pdata);
- }
- if (!pconfig.printlayout) {
- pconfig.printlayout = 'list';
- apppref.setpreference("pageconfig.waitlist",pconfig);
- }
-
- loadtextareas(200);
- set_infoheader("");
- load_waitlist_table();
-
-}
-
-//$('#tbl_waitlist').on( 'search.dt', function () {
-// pconfig.filter = tblwaitlist.api().search();
-// apppref.setpreference("pageconfig.waitlist",pconfig);
-//} );
-
-$('#tbl_waitlist').on( 'order.dt', function () {
- pconfig.order= tblwaitlist.fnSettings().aaSorting;
- apppref.setpreference("pageconfig.waitlist",pconfig);
-} );
-
-function load_waitlist_table(){
- var waitlistsql = "select uuid, '<span style=\"display:none\">' || strftime('%Y-%m-%d',waitdate) || '</span>' || strftime('%d.%m.%Y',waitdate) as waitdate, name,phone, email, age, note FROM waitlist order by waitdate;";
- var headerdata = [];
- headerdata = getlabelswithkey("act,waitdate,contactinfo,childinfo");
-
- var waitlistdata = appdb.dbquery(waitlistsql);
- $("#tbl_waitlist").html("");
- var tblheader = '<tr>';
- for (var h in headerdata){
- if ((headerdata[h].keyname == 'act') && (headerdata[h].class.indexOf('action1btn') == -1)){
- headerdata[h].class +=" action1btn";
- }
- tblheader += '<th class="' + headerdata[h].class +'">'+ headerdata[h].title+'</th>';
-
- }
- tblheader += '</tr>';
- tblacc = null;
- $("#tbl_waitlist").append("<thead>" + tblheader + "</thead>");
- $("#tbl_waitlist").append("<tbody>");
- for (var i in waitlistdata.sqldata){
- var row = waitlistdata.sqldata[i];
- var tr = '<tr><td class="noprint" style="width: 170px;"><button type="button" class="btn btn-primary" onclick="dlg_waitlist({\'uuid\':\'' +row.uuid + '\'},\'upd\');" title="editer"><span class="glyphicon glyphicon-pencil"></span></button>'+
- '<button type="button" class="btn btn-danger" onclick="dlg_waitlist({\'uuid\':\'' +row. uuid + '\'},\'del\');" title="supprimer"><span class="glyphicon glyphicon-remove"></span></button>'+
- '<button type="button" class="btn btn-primary" onclick="add_child(\'' + row.uuid + '\');" title="ajouter enfant"><span class="glyphicons glyphicons-child"></span><span class="glyphicons glyphicons-plus"></span></button></td>';
- tr += '<td style="width: 100px;">' + row.waitdate + '</td>';
- tr += '<td style="width: 300px;">' + ((row.name !=='')?row.name + '<br/>':'')+((row.phone !== '')?row.phone + '<br/>':'')+row.email + '</td>';
- tr += '<td>' + ((row.age !== '')?row.age+ '<br/>':'') + htmlUnescape(row.note) + '</td></tr>';
- $("#tbl_waitlist").append(tr);
-
- }
-
- $("#tbl_waitlist").append("</tbody>");
- tblwaitlist = $("#tbl_waitlist").dataTable({
- "language": {
- "url": "js/locale/datatable_fr.json"
- },
-
- "paging": false,
- "ordering": true,
- "scrollY": wh + "px",
- "scrollCollapse": true,
- "info": true,
- "filter": true,
- "destroy": true
- });
-// if (pconfig.filter) {
-// tblwaitlist.fnFilter(pconfig.filter);
-// }
- if (pconfig.order) {
- //dump(JSON.stringify(pconfig.order) + "\n");
- tblwaitlist.fnSort(pconfig.order);
- } else {
- pconfig.order = [[1,"asc"]];
- tblwaitlist.fnSort(pconfig.order);
- }
-}
-
-function dlg_waitlist(uuid,type){
- if ((type == 'upd') || (type == 'ins')) {
-
- var wlsql = "SELECT '0' as uuid,strftime('%d.%m.%Y',date('now')) as waitdate, '' as name, '' as phone, '' as email, ''as age, '' as note FROM waitlist LIMIT 1;";
- if (type == 'upd') {
-
- wlsql = "SELECT uuid, strftime('%d.%m.%Y',date(waitdate)) as waitdate, name, phone, email, age, note FROM waitlist where uuid='"+uuid.uuid+"';";
- }
- var wldata = appdb.dbquery(wlsql);
-
- wldata = wldata.sqldata[0];
- for (var w in wldata){
- if ($("#frmeditwaitlist #" +w)) {
- if ($("#frmeditwaitlist #"+w).prop("tagName") === "TEXTAREA"){
- $("#frmeditwaitlist #"+w).summernote('code',htmlUnescape(wldata[w]));
- }
- else {
- $("#frmeditwaitlist #"+w).val(wldata[w]);
- }
- }
- }
- $("#edit_waitlist").modal('show');
- }else if (type == 'del') {
- //dump("UUID to delete: " + JSON.stringify(uuid) + "\n");
- delwl = uuid.uuid;
- confirm_delete_waitlist();
- }
- }
-
- function confirm_delete_waitlist(){
-
- $("#confirm_delete_waitlist").modal('show');
- return false;
- }
-
- function delete_waitlist(){
-
- var delsql = "DELETE FROM waitlist where uuid='"+delwl +"';";
- //dump(JSON.stringify(delwl) + " - " + delsql + "\n");
- appdb.dbexec(delsql);
- delwl =null;
- load_waitlist_table();
-
- $("#confirm_delete_waitlist").modal('hide');
-
- return false;
- }
-
- function save_waitlist(){
- var sql1 = new Array();
- var sql2 = new Array();
- var type = 'ins';
- var cuuid = "";
- if ($("#frmeditwaitlist #uuid").val() != 0) {
- type = 'upd';
- cuuid = $("#frmeditwaitlist #uuid").val();
- }
- $("#frmeditwaitlist :input").each(function(){
- var input = $(this);
- if (input.attr("id")){
- if (type == 'ins') {
- sql1.push('"' + input.attr("id") + '"');
- if (input.attr("id") == 'uuid') {
- if (input.val() == "" || input.val() == "0") {
- sql2.push("'" + appdb.generate_uuid()+"'");
- }
- else {
- sql2.push("'" + input.val()+"'");
- }
- } else {
- var ival = encodeparam(input.val(),input.attr('type'));
- sql2.push(ival);
- }
- }else {
- if (input.attr("id") != 'uuid') {
- var ival = encodeparam(input.val(),input.attr('type'));
- sql2.push('"' + input.attr("id") +'"='+ ival);
- }
- }
-
-
- }
-
- });
- var xsql = "";
- if (type == 'upd') {
- xsql = "UPDATE waitlist SET "+sql2.join(',')+" where \"uuid\"='" + cuuid +"';";
- }else {
- xsql = "INSERT INTO waitlist ("+sql1.join(',')+") VALUES ("+sql2.join(',')+");";
- }
-
- appdb.dbexec(xsql);
- load_waitlist_table();
- $("#frmeditwaitlist #uuid").val("0");
- $("#edit_waitlist").modal('hide');
- }
-
-function print_list(){
- globelreq.send_request({page:'preview2',data:{page: 'waitlist'}});
-}
-
-function add_child(uuid){
-var newuuid = appdb.generate_uuid();
- var wlsql = "SELECT uuid, name, phone, email, age, note FROM waitlist where uuid='"+uuid+"';";
- var wldata = appdb.dbquery(wlsql);
- appdb.dbexec("insert into childs (uuid,birthday,entrydate,leavedate,remark) VALUES ('" + newuuid + "',date('now','-2 months'),date('now'),date('now'),'"+ appdb.strreplace(wldata.sqldata[0].name + '<br/>' + wldata.sqldata[0].phone + '<br/>' + wldata.sqldata[0].email+ '<br/>' + wldata.sqldata[0].age + '<br/>' +htmlUnescape(wldata.sqldata[0].note)) +"');");
- appdb.dbexec("DELETE FROM waitlist where waitlist='"+ uuid +"';");
- globelreq.send_request({
- page: 'child',
- data: {
- "uuid": newuuid
- },
- header: 'Enfant'
- });
-}
\ No newline at end of file
--- /dev/null
+const { dialog } = require('electron').remote;
+const fs = require('fs');
+const os = require('os');
+var usersystem = {
+ profilepath: function(){
+ var ppath="";
+ if (os.platform() == "darwin"){
+ ppath = os.homedir() + '/Library/Application Support/invoicejournal/';
+ } else if (os.platform() == "Win32") {
+ ppath = os.homedir() + '/AppData/Roaming/invoicejournal/';
+ }
+ return ppath;
+ },
+ selectfile: function(dlgtitle,lastpath,filefilters=null){
+ return dialog.showOpenDialog({title: dlgtitle,defaultPath: lastpath, filters: filefilters, properties: ['openFile'] });
+ },
+ selectdir: function(dlgtitle,lastpath){
+ return dialog.showOpenDialog({title: dlgtitle,defaultPath: lastpath, filters: filefilters, properties: ['openDirectory'] });
+ },
+ showMessage: function(msgTitle,msg,msgdetail,msgtype,msgButtons=["OK"],defautlbtnid=0,cancelbtnid){
+ return dialog.showMessageBox({type: msgtype, //
+ title: msgTitle,
+ buttons:msgButtons,
+ message: msg,
+ detail: msgdetail,
+ defaultId: defautlbtnid,
+ cancelId: cancelbtnid});
+ },
+ showError: function(errtitle,errmsg){
+ dialog.showErrorBox(errtitle, errmsg);
+ },
+ setPreference: function(key,data){
+ //console.log("save preferences to: " + this.profilepath() + key + ".json");
+ if ((typeof data == 'object') || (typeof data == 'array')){
+ data = JSON.stringify(data);
+ }
+ var result = fs.writeFileSync(this.profilepath() + key + ".json", data);
+ return result;
+ },
+ getPreference: function(key){
+ var data = null;
+ if (fs.existsSync(this.profilepath() + key + ".json")){
+ console.log("Read Key:" + key);
+ var data = fs.readFileSync(this.profilepath() + key + ".json", 'utf-8');
+ if (data.startsWith("{") || data.startsWith("[")){
+ data = JSON.parse(data);
+ }
+ return data;
+ }
+ return data;
+ },
+ getLocalDataSets: function(){
+ var datasets =[];
+ var files = fs.readdirSync(this.profilepath());
+ files.forEach(function(file) {
+ if (file.match('db\..*\.json')){
+ datasets.push(file.replace('.json',''));
+ }
+ });
+ return datasets;
+ },
+ getsysinfo: function(){
+ return {
+ "hostname": os.hostname(),
+ "userdir": os.homedir(),
+ "platform": os.platform(),
+ "userinfo":os.userInfo()
+ }
+ }
+}
+