| 1 | {**************************************************************************} |
| 2 | {* *} |
| 3 | {* Copyright (C) 2003-2011 Polytechnique.org *} |
| 4 | {* http://opensource.polytechnique.org/ *} |
| 5 | {* *} |
| 6 | {* This program is free software; you can redistribute it and/or modify *} |
| 7 | {* it under the terms of the GNU General Public License as published by *} |
| 8 | {* the Free Software Foundation; either version 2 of the License, or *} |
| 9 | {* (at your option) any later version. *} |
| 10 | {* *} |
| 11 | {* This program is distributed in the hope that it will be useful, *} |
| 12 | {* but WITHOUT ANY WARRANTY; without even the implied warranty of *} |
| 13 | {* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *} |
| 14 | {* GNU General Public License for more details. *} |
| 15 | {* *} |
| 16 | {* You should have received a copy of the GNU General Public License *} |
| 17 | {* along with this program; if not, write to the Free Software *} |
| 18 | {* Foundation, Inc., *} |
| 19 | {* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *} |
| 20 | {* *} |
| 21 | {**************************************************************************} |
| 22 | |
| 23 | <h1>Réconciliation - {$title}</h1> |
| 24 | |
| 25 | {if $step eq 'list'} |
| 26 | |
| 27 | <form method="POST" action="admin/reconcile/transfers"> |
| 28 | <table class="bicol"> |
| 29 | <tr class="impair"> |
| 30 | <th> </th><th>id</th><th>method</th><th>du</th><th>au</th><th>statut</th><th>transactions</th><th>total (€)</th><th>coms (€)</th><th>actions</th> |
| 31 | </tr> |
| 32 | <tr class="impair" style="border-top: 1px solid #A2C2E1"> |
| 33 | <th> </th> |
| 34 | <th style="text-align: left" colspan="9">non régroupées</th> |
| 35 | </tr> |
| 36 | <tr class="pair"> |
| 37 | <td> </td> |
| 38 | <td colspan="8"><strong><a href="admin/reconcile/importlogs/step1">Créer une nouvelle réconciliation</a></strong></td> |
| 39 | <td class="right"><a href="admin/reconcile/importlogs/step1">{icon name=add title='nouvelle réconciliation'}</a></td> |
| 40 | </tr> |
| 41 | {foreach from=$recongps item=recongp} |
| 42 | {assign var='sum1' value='0'} |
| 43 | {assign var='sum2' value='0'} |
| 44 | {assign var='sum3' value='0'} |
| 45 | {if $recongp.id} |
| 46 | <tr class="impair"><td colspan="10"> </td></tr> |
| 47 | <tr class="impair" style="border-top: 1px solid #A2C2E1"> |
| 48 | <th> </th> |
| 49 | <th style="text-align: left" colspan="8">groupe ID {$recongp.id}</th> |
| 50 | <th style="text-align: right"><a href="admin/reconcile/transfers/delgroup/{$recongp.id}?token={xsrf_token}">{icon name=delete title='supprimer'}</a></th> |
| 51 | </tr> |
| 52 | {/if} |
| 53 | {foreach from=$recongp.recons item=recon} |
| 54 | {assign var='sum1' value=`$sum1+$recon.payment_count`} |
| 55 | {assign var='sum2' value=`$sum2+$recon.sum_amounts`} |
| 56 | {assign var='sum3' value=`$sum3+$recon.sum_commissions`} |
| 57 | <tr class="pair"> |
| 58 | <td> |
| 59 | {if $recon.status eq 'transfering'} |
| 60 | <input type="checkbox" name="recon_id[{$recon.id}]" /> |
| 61 | {else} |
| 62 | |
| 63 | {/if} |
| 64 | </td> |
| 65 | <td>{$recon.id}</td> |
| 66 | <td>{$recon.method}</td> |
| 67 | <td>{$recon.period_start}</td> |
| 68 | <td>{$recon.period_end}</td> |
| 69 | <td>{$recon.status}</td> |
| 70 | <td class="right">{$recon.payment_count}</td> |
| 71 | <td class="right">{$recon.sum_amounts}</td> |
| 72 | <td class="right">{$recon.sum_commissions}</td> |
| 73 | <td class="right">{if $recongp.id} {else}<a href="admin/reconcile/delete/{$recon.id}?token={xsrf_token}">{icon name=delete title='supprimer'}</a>{/if}</td> |
| 74 | </tr> |
| 75 | {/foreach} |
| 76 | {if $recongp.id} |
| 77 | <tr class="impair"> |
| 78 | <td colspan="5"> </td> |
| 79 | <td class="right">total :</td> |
| 80 | <td class="right">{$sum1}</td> |
| 81 | <td class="right">{$sum2|string_format:"%.2f"}</td> |
| 82 | <td class="right">{$sum3|string_format:"%.2f"}</td> |
| 83 | <td> </td> |
| 84 | </tr> |
| 85 | <tr><td colspan="10"> |
| 86 | <table class="bicol"> |
| 87 | <tr> |
| 88 | <th>id</th><th>date</th><th>message</th><th>RIB</th><th>€</th><th>action</th> |
| 89 | </tr> |
| 90 | {assign var='sum' value='0'} |
| 91 | {foreach from=$recongp.transfers item=transfer} |
| 92 | {assign var='sum' value=`$sum+$transfer.amount`} |
| 93 | <tr class="{cycle values="pair,impair"}"> |
| 94 | <td>{$transfer.id}</td> |
| 95 | <td>{if $transfer.date}{$transfer.date}{else}à virer{/if}</td> |
| 96 | <td><small>{$transfer.message}</small></td> |
| 97 | <td>{$transfer.account}</td> |
| 98 | <td class="right">{$transfer.amount}</td> |
| 99 | <td class="right"> |
| 100 | {if !$transfer.date}<a href="admin/reconcile/transfers/confirm/{$transfer.id}?token={xsrf_token}">{icon name=tick title='Confirmer la réalisation'}</a>{/if} |
| 101 | <a href="admin/reconcile/transfers/edit/{$transfer.id}?token={xsrf_token}">{icon name=page_edit title='Éditer'}</a> |
| 102 | </td> |
| 103 | </tr> |
| 104 | {/foreach} |
| 105 | </table> |
| 106 | </td></tr> |
| 107 | <tr class="impair"> |
| 108 | <td colspan="6"> </td> |
| 109 | <td class="right">total :</td> |
| 110 | <td colspan="2">{$sum|string_format:"%.2f"} - coms = {$sum-$sum3|string_format:"%.2f"}</td> |
| 111 | <td> </td> |
| 112 | </tr> |
| 113 | {/if} |
| 114 | {/foreach} |
| 115 | </table> |
| 116 | <p><input type="submit" name="generate" value="Grouper et créer les virements" /></p> |
| 117 | </form> |
| 118 | |
| 119 | {elseif $step eq 'step1'} |
| 120 | |
| 121 | <table class="bicol"> |
| 122 | <tr class="impair"> |
| 123 | <th>Choix de la méthode de paiement</th> |
| 124 | </tr> |
| 125 | {foreach from=$methods item=method} |
| 126 | <tr class="{cycle values="pair,impair"}"> |
| 127 | <td> |
| 128 | <a href="admin/reconcile/importlogs/step1/{$method.id}">{$method.text}</a> |
| 129 | </td> |
| 130 | </tr> |
| 131 | {/foreach} |
| 132 | </table> |
| 133 | |
| 134 | {elseif $step eq 'step2'} |
| 135 | |
| 136 | {include core=csv-importer.tpl} |
| 137 | |
| 138 | {elseif $step eq 'step3'} |
| 139 | |
| 140 | <form method="POST"> |
| 141 | {xsrf_token_field} |
| 142 | <table class="bicol"> |
| 143 | <tr class="impair"> |
| 144 | <th colspan="3">Récapitulatif des informations de réconciliation</th> |
| 145 | </tr> |
| 146 | <tr class="pair"> |
| 147 | <td width="30%">ID de la méthode de paiement:</td> |
| 148 | <td colspan="2">{$recon.method_id}</td> |
| 149 | </tr> |
| 150 | <tr class="impair"> |
| 151 | <td>Début de période :</td> |
| 152 | <td colspan="2"> |
| 153 | <input type="text" name="period_start" value="{$recon.period_start}" maxlength="10" /> |
| 154 | <em>jj/mm/aaaa</em> |
| 155 | </td> |
| 156 | </tr> |
| 157 | <tr class="pair"> |
| 158 | <td>Fin de période :</td> |
| 159 | <td colspan="2"> |
| 160 | <input type="text" name="period_end" value="{$recon.period_end}" maxlength="10" /> |
| 161 | <em>jj/mm/aaaa</em> |
| 162 | </td> |
| 163 | </tr> |
| 164 | <tr class="impair"> |
| 165 | <td>Nombre de transactions :</td> |
| 166 | <td colspan="2">{$recon.payment_count}</td> |
| 167 | </tr> |
| 168 | <tr class="pair"> |
| 169 | <td>Total des paiements :</td> |
| 170 | <td>{$recon.sum_amounts|string_format:"%.2f"|replace:'.':','}€</td> |
| 171 | <td>(environ {$recon.sum_amounts/$recon.payment_count|string_format:"%.2f"|replace:'.':','}€/paiement)</td> |
| 172 | </tr> |
| 173 | <tr class="impair"> |
| 174 | <td>Total des commissions :</td> |
| 175 | <td>{$recon.sum_commissions|string_format:"%.2f"|replace:'.':','}€</td> |
| 176 | <td>(environ {$recon.sum_commissions/$recon.sum_amounts*100|string_format:"%.2f"|replace:'.':','}%)</td> |
| 177 | </tr> |
| 178 | </table> |
| 179 | |
| 180 | <br /> |
| 181 | |
| 182 | <table class="bicol"> |
| 183 | <tr class="impair"> |
| 184 | <th colspan="2">À l'étape suivante, une comparaison entre les transactions existantes et la liste importé va être réalisée.</th> |
| 185 | </tr> |
| 186 | <tr class="pair"> |
| 187 | <td width="30%">Vérification à faire :</td> |
| 188 | <td> |
| 189 | <label><input type="checkbox" name="check1" checked="checked" disabled="disabled"/> apparier les transactions</label><br /> |
| 190 | <label><input type="checkbox" name="check2" checked="checked" /> afficher les transactions existantes orphelines</label><br /> |
| 191 | <label><input type="checkbox" name="check3" checked="checked" /> afficher les transactions importées orphelines</label><br /> |
| 192 | </td> |
| 193 | </tr> |
| 194 | </table> |
| 195 | |
| 196 | <p class="center"><input type="submit" name="next" value="étape suivante" /></p> |
| 197 | </form> |
| 198 | |
| 199 | {elseif $step eq 'step4'} |
| 200 | |
| 201 | <p>ok : {$ok_count}<br /> |
| 202 | differ : {$differ_count}<br /> |
| 203 | onlydb : {$onlydb_count}<br /> |
| 204 | onlyim : {$onlyim_count}<br /> |
| 205 | total (excepted onlydb) : {$ok_count+$differ_count+$onlyim_count} (doit être égal à {$recon.payment_count}) |
| 206 | </p> |
| 207 | |
| 208 | <h2>Enregistrements avec champs qui diffèrent</h2> |
| 209 | |
| 210 | {if $differ_count ne 0} |
| 211 | <table class="bicol"> |
| 212 | <tr class="impair"> |
| 213 | <th>Référence</th><th>method_id</th><th>Date</th> |
| 214 | <th>Montant</th><th>Com</th><th>Statut</th> |
| 215 | <th>recon_id</th><th>Action</th> |
| 216 | </tr> |
| 217 | {foreach from=$differs item=i} |
| 218 | <tr class="{cycle values="pair,impair"}"> |
| 219 | <td>{$i.fullref}<br />{$i.reference}</td> |
| 220 | <td>{$i.method_id}<br /> </td> |
| 221 | <td>{$i.ts_confirmed}<br />{$i.date}</td> |
| 222 | <td>{$i.amount}<br />{$i.amount2}</td> |
| 223 | <td>{$i.commission}<br />{$i.commission2}</td> |
| 224 | <td>{$i.status}<br /> </td> |
| 225 | <td>{$i.recon_id}<br /> </td> |
| 226 | <td><form method="POST">{xsrf_token_field}<input type="submit" name="force[{$i.id}]" value="Forcer" /></form></td> |
| 227 | </tr> |
| 228 | {/foreach} |
| 229 | </table> |
| 230 | {else} |
| 231 | <p>Aucun</p> |
| 232 | {/if} |
| 233 | |
| 234 | <h2>Enregistrements uniquement dans la base</h2> |
| 235 | |
| 236 | {if $onlydb_count ne 0} |
| 237 | <table class="bicol"> |
| 238 | {assign var='headerstatus' value='doheader'} |
| 239 | {foreach from=$only_database item=i} |
| 240 | {if $headerstatus eq 'doheader'} |
| 241 | {assign var='headerstatus' value='headerdone'} |
| 242 | <tr class="impair"> |
| 243 | {foreach from=$i key=k item=v} |
| 244 | <th>{$k}</th> |
| 245 | {/foreach} |
| 246 | </tr> |
| 247 | {/if} |
| 248 | <tr class="{cycle values="pair,impair"}"> |
| 249 | {foreach from=$i key=k item=v} |
| 250 | <td>{$v}</td> |
| 251 | {/foreach} |
| 252 | </tr> |
| 253 | {/foreach} |
| 254 | </table> |
| 255 | {else} |
| 256 | <p>Aucun</p> |
| 257 | {/if} |
| 258 | |
| 259 | <h2>Enregistrements uniquement dans l'import</h2> |
| 260 | |
| 261 | {if $onlyim_count ne 0} |
| 262 | <table class="bicol"> |
| 263 | {assign var='headerstatus' value='doheader'} |
| 264 | {foreach from=$only_import item=i} |
| 265 | {if $headerstatus eq 'doheader'} |
| 266 | {assign var='headerstatus' value='headerdone'} |
| 267 | <tr class="impair"> |
| 268 | {foreach from=$i key=k item=v} |
| 269 | <th>{$k}</th> |
| 270 | {/foreach} |
| 271 | </tr> |
| 272 | {/if} |
| 273 | <tr class="{cycle values="pair,impair"}"> |
| 274 | {foreach from=$i key=k item=v} |
| 275 | <td>{$v}</td> |
| 276 | {/foreach} |
| 277 | </tr> |
| 278 | {/foreach} |
| 279 | </table> |
| 280 | {else} |
| 281 | <p>Aucun</p> |
| 282 | {/if} |
| 283 | |
| 284 | <h2>Commentaires</h2> |
| 285 | |
| 286 | <p>Les tableaux si dessus ne seront pas enregistrés, il convient donc de reprendre leur contenu dans |
| 287 | le champ de commentaires si dessous, si nécesssaire.</p> |
| 288 | |
| 289 | <form method="POST"> |
| 290 | {xsrf_token_field} |
| 291 | <textarea name="comments" rows="10" cols="100">{$recon.comments}</textarea> |
| 292 | <input type="submit" name="savecomments" value="Enregistrer les commentaires" /></p> |
| 293 | </form> |
| 294 | |
| 295 | <h2>Suite</h2> |
| 296 | |
| 297 | <form method="POST"> |
| 298 | <p class="center"><input type="submit" name="next" value="Terminer la réconciliation" /></p> |
| 299 | </form> |
| 300 | |
| 301 | {else} {* defaults to "list" *} |
| 302 | {assign var='dontshowback' value='dontshowback'} |
| 303 | |
| 304 | TODO: listing |
| 305 | |
| 306 | {/if} |
| 307 | |
| 308 | {if $dontshowback} |
| 309 | <p> |
| 310 | <a href="admin/reconcile">back</a> |
| 311 | </p> |
| 312 | {/if} |