<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/vendor/bootstrap-table/bootstrap-table.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">
- <style>
- #tbl_vacancy tbody {
- display:block;
- overflow-y: scroll;
- height:200px;
- width:100%;
- }
- #tbl_vacancy thead tr{
- display:block;
- }
- </style>
</head>
<body>
</div>
</div>
- <div style="width: 1220px;">
- <table id="tbl_vacancy" class="table table-striped table-bordered" >
+
+ <table id="tbl_vacancy" class="table table-striped table-bordered" data-toggle="table" data-heigth="10vh" style="width: 100%;" >
<thead>
<tr>
- <th class="noprint" rowspan="2" style="width: 120px;"></th>
- <th rowspan="2" style="width: 80px;">année</th>
- <th colspan="2">Date</th>
- <th>Heures</th>
- <th rowspan="2" style="width: 250px;">Description</th>
- <th rowspan="2" style="width: 100px;">type</th>
- <th colspan="3">demandé</th>
- <th colspan="3">validé</th>
- </tr>
- <tr>
-
-
+ <th class="noprint" style="width: 120px;"></th>
+ <th style="width: 80px;">année</th>
<th style="width: 100px;">début</th>
<th style="width: 100px;">fin</th>
- <th style="width: 60px;">par jour</th>
-
- <th style="width: 60px;">normal</th>
- <th style="width: 60px;">except.</th>
- <th style="width: 60px;">maladie</th>
- <th style="width: 60px;">normal</th>
- <th style="width: 60px;">except.</th>
- <th style="width: 60px;">maladie</th>
+ <th style="width: 60px;">jours</th>
+ <th style="width: 60px;">h/j</th>
+ <th style="width: 250px;">Description</th>
+ <th style="width: 100px;">type</th>
+ <th style="width: 60px;" colspan="2">normal</th>
+ <th style="width: 60px;" colspan="2">except.</th>
+ <th style="width: 60px;" colspan="2">maladie</th>
</tr>
</thead>
<tbody></tbody>
<tfoot></tfoot>
</table>
- </div>
+
<div id="vacancystatus" style=" white-space: nowrap; width: 100%; text-align: center;"></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/vendor/bootstrap-table/bootstrap-table.min.js" type="text/javascript"></script>
<script src="../../web/vendor/bootstrap-table/locale/bootstrap-table-fr-FR.js" type="text/javascript"></script>
<script src="../../web/js/moment-with-locales.js" type="text/javascript"></script>
<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/vendor/bootstrap-table/bootstrap-table.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">
</div>
</div>
- <table id="tbl_activity" class="table table-striped">
-
+ <table id="tbl_activity" class="table table-striped table-bordered">
+ <thead></thead>
+ <tfoot></tfoot>
+ <tbody></tbody>
</table>
</div>
<div id="vacancy" class="tab-pane">
- <div class="form-group form-inline">
+ <div class="form-group form-inline" id="mnuvac">
<label for="year_vacancy">Année:</label>
<div class="input-group">
<select id="year_vacancy" class="selyear">
</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>
+ <table id="tbl_vacancy" class="table table-striped table-bordered" data-toggle="table" data-heigth="10vh" style="width: 100%;" >
+ <thead>
+ <tr>
+ <th class="noprint" style="width: 120px;"></th>
+ <th style="width: 80px;">année</th>
+ <th style="width: 100px;">début</th>
+ <th style="width: 100px;">fin</th>
+ <th style="width: 60px;">jours</th>
+ <th style="width: 60px;">h/j</th>
+ <th style="width: 250px;">Description</th>
+ <th style="width: 100px;">type</th>
+ <th style="width: 60px;" colspan="2">normal</th>
+ <th style="width: 60px;" colspan="2">except.</th>
+ <th style="width: 60px;" colspan="2">maladie</th>
+ </tr>
+ </thead>
+ <tbody></tbody>
+ <tfoot></tfoot>
+ </table>
<div id="vacancystatus" style=" white-space: nowrap; width: 100%; text-align: center;"></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/vendor/bootstrap-table/bootstrap-table.min.js" type="text/javascript"></script>
+ <script src="../../web/vendor/bootstrap-table/locale/bootstrap-table-fr-FR.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> -->
if (pdata != '') {
pconfig = JSON.parse(pdata);
}
+ appdb.dbexec("update vacancycalendar set vacyear=strftime('%Y',datefrom) where vacyear is null;");
//"get CoWorker cfg:" +JSON.stringify(pconfig) + "\n");
if (!pconfig.year) {
pconfig.year=new Date().getFullYear();
$("#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 (" +
+ "strftime('%d.%m.%Y', datefrom) as datefrom,strftime('%d.%m.%Y', dateto) as dateto,printf(\"%.2f\",dayhours) as dayhours,totaldays,description," +
+ "case when type = 0 and accepted != '1' then printf(\"%.2f\", hours) else '' end as thnormalnv," +
+ "case when type = 1 and accepted != '1' then printf(\"%.2f\", hours) else '' end as thextranv," +
+ "case when type =-1 and accepted != '1' then printf(\"%.2f\", hours) else '' end as thillnv," +
+ "case when type = 0 and accepted = '1' then printf(\"%.2f\", hours) else '' end as thnormalval," +
+ "case when type = 1 and accepted = '1' then printf(\"%.2f\", hours) else '' end as thextraval," +
+ "case when type =-1 and accepted = '1' then printf(\"%.2f\", hours) else '' end as thillval," +
+ "case when type = 0 then 'normal' when type = 1 then 'exceptionnel' when type =-1 then 'maladie' end as vacancytype" +
+ " FROM (" +
+ "select uuid, vacyear, datefrom, dateto, type, description, accepted, (days-day_to_much-vdays) * (case when hours < maxdayhours then hours when hours > maxdayhours then maxdayhours else hours end ) as hours, "+
+ "case when hours < maxdayhours then hours when hours > maxdayhours then maxdayhours else hours end as dayhours,days-day_to_much-vdays as totaldays " +
+ " 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+");";
+ "from vacancycalendar vc join staff st on (vc.staffuuid=st.uuid) where vc.staffuuid='"+ pconfig.uuid+"' and vc.vacyear=" + pconfig.year+"));";
//jsdump("XXSQL:" + vacdatasql + "\n");
var vacdata = appdb.dbquery(vacdatasql);
-
- // $('#tbl_vacancy').html("");
- // var headerdata = getlabelswithkey("action,vacyear,datefrom,dateto,dayhours,description,thnormalnv,thextranv,thillnv,thnormalval,thextraval,thillval,vacancytype,accepted");
+ var sums = { normal:0,except:0,ill:0,normal_ok:0,except_ok:0,ill_ok:0};
+
$("#tbl_vacancy > tbody").html("");
- //$("#tbl_vacancy > tfoot").html("");
- // $("#tbl_vacancy > thead").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 +'" data-sortable="true" style="height: 80px;">'+ headerdata[h].title+'</th>';
- // }
- // tblheader += '</tr>';
- // $("#tbl_vacancy").append('<thead>'+ tblheader + '</thead>');
- // jsdump(tblheader);
- // $("#tbl_vacancy").append('<tbody>');
+
for (var i in vacdata.sqldata){
var row = vacdata.sqldata[i];
-
+ // sums.all = sums.all + ((row.dayhours != '')?parseFloat(row.dayhours):0.00);
+ sums.normal = sums.normal + ((row.thnormalnv != '')?parseFloat(row.thnormalnv):0.00);
+ sums.except = sums.except + ((row.thextranv != '')?parseFloat(row.thextranv):0.00);
+ sums.ill = sums.ill + ((row.thillnv != '')?parseFloat(row.thillnv):0.00);
+ sums.normal_ok = sums.normal_ok + ((row.thnormalval != '')?parseFloat(row.thnormalval):0.00);
+ sums.except_ok = sums.except_ok + ((row.thextraval != '')?parseFloat(row.thextraval):0.00);
+ sums.ill_ok = sums.ill_ok + ((row.thillval != '')?parseFloat(row.thillval):0.00);
var tr = '<tr>';
tr += '<td style="width: 120px;">' + row.action + '</td>';
tr += '<td style="width: 80px;">' + row.vacyear + '</td>';
tr += '<td style="width: 100px;">' + row.datefrom + '</td>';
tr += '<td style="width: 100px;">' + row.dateto + '</td>';
- tr += '<td style="width: 60px;">' + row.dayhours + '</td>';
+ tr += '<td class="alignright" style="width: 60px;">' + row.totaldays + '</td>';
+ tr += '<td class="alignright" style="width: 60px;">' + row.dayhours + '</td>';
tr += '<td style="width: 250px;">' + row.description + '</td>';
tr += '<td style="width: 100px;">' + row.vacancytype + '</td>';
- tr += '<td style="color: red;width: 60px;">' + row.thnormalnv + '</td>';
- tr += '<td style="color: red;width: 60px;">' + row.thextranv + '</td>';
- tr += '<td style="color: red;width: 60px;">' + row.thillnv + '</td>';
- tr += '<td style="color: green;width: 60px;">' + row.thnormalval + '</td>';
- tr += '<td style="color: green;width: 60px;">' + row.thextraval + '</td>';
- tr += '<td style="color: green;width: 60px;">' + row.thillval + '</td>';
+ tr += '<td class="alignright" style="color: red;width: 60px;">' + row.thnormalnv + '</td>';
+ tr += '<td class="alignright" style="color: green;width: 60px;">' + row.thnormalval + '</td>';
+ tr += '<td class="alignright" style="color: red;width: 60px;">' + row.thextranv + '</td>';
+ tr += '<td class="alignright" style="color: green;width: 60px;">' + row.thextraval + '</td>';
+ tr += '<td class="alignright" style="color: red;width: 60px;">' + row.thillnv + '</td>';
+ tr += '<td class="alignright" style="color: green;width: 60px;">' + row.thillval + '</td>';
tr += '<tr>';
$("#tbl_vacancy > tbody").append(tr);
}
-// $("#tbl_vacancy").bootstrapTable({
-// locale: 'fr-FR',
-// pagination: false,
-// search: false,
-// //height: wh,
-// toolbar: "#mnuvac"
-// });
+ var tfoot = "<tr>"
+ + '<th style="width: 120px;"></th>'
+ + '<th style="width: 80px;"></th>'
+ + '<th style="width: 100px;"></th>'
+ + '<th style="width: 100px;"></th>'
+ + '<th style="width: 60px;"></th>'
+ + '<th style="width: 60px;"></th>'
+ + '<th style="width: 250px;"></th>'
+ + '<th style="width: 100px;"></th>'
+ + '<th class="alignright" style="color: red;width: 60px;">' + sums.normal.toFixed(2) + '</th>'
+ + '<th class="alignright" style="color: green;width: 60px;">' + sums.normal_ok.toFixed(2) + '</th>'
+ + '<th class="alignright" style="color: red;width: 60px;">' + sums.except.toFixed(2) + '</th>'
+ + '<th class="alignright" style="color: green;width: 60px;">' + sums.except_ok.toFixed(2) + '</th>'
+ + '<th class="alignright" style="color: red;width: 60px;">' + sums.ill.toFixed(2) + '</th>'
+ + '<th class="alignright" style="color: green;width: 60px;">' + sums.ill_ok.toFixed(2) + '</th>'
+ +"</tr>";
+ $("#tbl_vacancy > tfoot").html(tfoot);
+
+ $("#tbl_vacancy").bootstrapTable({
+ locale: 'fr-FR',
+ pagination: false,
+ search: false,
+ toolbar: "#mnuvac"
+ });
pconfig.printlayout = 'list';
apppref.setpreference("pageconfig.coworker",pconfig);
}
+ appdb.dbexec("update vacancycalendar set vacyear=strftime('%Y',datefrom) where vacyear is null;");
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];
$("#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").append(tblbody.join(''));
+ $("#tbl_activity").append("</tbody>");
+
+ $("#tbl_activity").bootstrapTable({
+ locale: 'fr-FR',
+ pagination: false,
+ search: false,
+ height: wh,
+ toolbar: "#mnuact"
});
-
- //$('#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);
-
+ tblvac =null;
+ var yearvacanysql = "select hours from staffvacancydays where staffuuid='"+ pconfig.uuid+"' and vacancyyear='"+ $("#year_vacancy").val() +"';";
+ var yearvac = appdb.dbquery(yearvacanysql);
+ var nvyear = "";
+ if ((yearvac) && (yearvac.sqldata.length > 0)){
+ nvyear = yearvac.sqldata[0].hours;
+ }
+ $("#vacancyyeartotal").val(nvyear);
+ 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," + "vacyear," +
+ "strftime('%d.%m.%Y', datefrom) as datefrom,strftime('%d.%m.%Y', dateto) as dateto,printf(\"%.2f\",dayhours) as dayhours,totaldays,description," +
+ "case when type = 0 and accepted != '1' then printf(\"%.2f\", hours) else '' end as thnormalnv," +
+ "case when type = 1 and accepted != '1' then printf(\"%.2f\", hours) else '' end as thextranv," +
+ "case when type =-1 and accepted != '1' then printf(\"%.2f\", hours) else '' end as thillnv," +
+ "case when type = 0 and accepted = '1' then printf(\"%.2f\", hours) else '' end as thnormalval," +
+ "case when type = 1 and accepted = '1' then printf(\"%.2f\", hours) else '' end as thextraval," +
+ "case when type =-1 and accepted = '1' then printf(\"%.2f\", hours) else '' end as thillval," +
+ "case when type = 0 then 'normal' when type = 1 then 'exceptionnel' when type =-1 then 'maladie' end as vacancytype" +
+ " FROM (" +
+ "select uuid, vacyear, datefrom, dateto, type, description, accepted, (days-day_to_much-vdays) * (case when hours < maxdayhours then hours when hours > maxdayhours then maxdayhours else hours end ) as hours, "+
+ "case when hours < maxdayhours then hours when hours > maxdayhours then maxdayhours else hours end as dayhours,days-day_to_much-vdays as totaldays " +
+ " 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+"));";
- $('#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
+//jsdump("XXSQL:" + vacdatasql + "\n");
+var vacdata = appdb.dbquery(vacdatasql);
+ var sums = { normal:0,except:0,ill:0,normal_ok:0,except_ok:0,ill_ok:0};
+
+ $("#tbl_vacancy > tbody").html("");
+
+ for (var i in vacdata.sqldata){
+ var row = vacdata.sqldata[i];
+ // sums.all = sums.all + ((row.dayhours != '')?parseFloat(row.dayhours):0.00);
+ sums.normal = sums.normal + ((row.thnormalnv != '')?parseFloat(row.thnormalnv):0.00);
+ sums.except = sums.except + ((row.thextranv != '')?parseFloat(row.thextranv):0.00);
+ sums.ill = sums.ill + ((row.thillnv != '')?parseFloat(row.thillnv):0.00);
+ sums.normal_ok = sums.normal_ok + ((row.thnormalval != '')?parseFloat(row.thnormalval):0.00);
+ sums.except_ok = sums.except_ok + ((row.thextraval != '')?parseFloat(row.thextraval):0.00);
+ sums.ill_ok = sums.ill_ok + ((row.thillval != '')?parseFloat(row.thillval):0.00);
+ var tr = '<tr>';
+ tr += '<td style="width: 120px;">' + row.action + '</td>';
+ tr += '<td style="width: 80px;">' + row.vacyear + '</td>';
+ tr += '<td style="width: 100px;">' + row.datefrom + '</td>';
+ tr += '<td style="width: 100px;">' + row.dateto + '</td>';
+ tr += '<td class="alignright" style="width: 60px;">' + row.totaldays + '</td>';
+ tr += '<td class="alignright" style="width: 60px;">' + row.dayhours + '</td>';
+ tr += '<td style="width: 250px;">' + row.description + '</td>';
+ tr += '<td style="width: 100px;">' + row.vacancytype + '</td>';
+ tr += '<td class="alignright" style="color: red;width: 60px;">' + row.thnormalnv + '</td>';
+ tr += '<td class="alignright" style="color: green;width: 60px;">' + row.thnormalval + '</td>';
+ tr += '<td class="alignright" style="color: red;width: 60px;">' + row.thextranv + '</td>';
+ tr += '<td class="alignright" style="color: green;width: 60px;">' + row.thextraval + '</td>';
+ tr += '<td class="alignright" style="color: red;width: 60px;">' + row.thillnv + '</td>';
+ tr += '<td class="alignright" style="color: green;width: 60px;">' + row.thillval + '</td>';
+ tr += '<tr>';
+ $("#tbl_vacancy > tbody").append(tr);
+
+ }
+ var tfoot = "<tr>"
+ + '<th style="width: 120px;"></th>'
+ + '<th style="width: 80px;"></th>'
+ + '<th style="width: 100px;"></th>'
+ + '<th style="width: 100px;"></th>'
+ + '<th style="width: 60px;"></th>'
+ + '<th style="width: 60px;"></th>'
+ + '<th style="width: 250px;"></th>'
+ + '<th style="width: 100px;"></th>'
+ + '<th class="alignright" style="color: red;width: 60px;">' + sums.normal.toFixed(2) + '</th>'
+ + '<th class="alignright" style="color: green;width: 60px;">' + sums.normal_ok.toFixed(2) + '</th>'
+ + '<th class="alignright" style="color: red;width: 60px;">' + sums.except.toFixed(2) + '</th>'
+ + '<th class="alignright" style="color: green;width: 60px;">' + sums.except_ok.toFixed(2) + '</th>'
+ + '<th class="alignright" style="color: red;width: 60px;">' + sums.ill.toFixed(2) + '</th>'
+ + '<th class="alignright" style="color: green;width: 60px;">' + sums.ill_ok.toFixed(2) + '</th>'
+ +"</tr>";
+ $("#tbl_vacancy > tfoot").html(tfoot);
+
+ $("#tbl_vacancy").bootstrapTable({
+ locale: 'fr-FR',
+ pagination: false,
+ search: false,
+ toolbar: "#mnuvac"
});
}