kanban mode for list of various payment
This commit is contained in:
parent
aea48e87de
commit
440d72ba9d
@ -768,4 +768,41 @@ class PaymentVarious extends CommonObject
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return clicable link of object (with eventually picto)
|
||||
*
|
||||
* @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link)
|
||||
* @return string HTML Code for Kanban thumb.
|
||||
*/
|
||||
public function getKanbanView($option = '')
|
||||
{
|
||||
global $langs;
|
||||
$return = '<div class="box-flex-item box-flex-grow-zero">';
|
||||
$return .= '<div class="info-box info-box-sm">';
|
||||
$return .= '<span class="info-box-icon bg-infobox-action">';
|
||||
$return .= img_picto('', $this->picto);
|
||||
$return .= '</span>';
|
||||
$return .= '<div class="info-box-content">';
|
||||
$return .= '<span class="info-box-ref">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).'</span>';
|
||||
if (property_exists($this, 'fk_bank')) {
|
||||
$return .= ' | <span class="info-box-status ">'.$this->fk_bank.'</span>';
|
||||
}
|
||||
if (property_exists($this, 'datep')) {
|
||||
$return .= '<br><span class="opacitymedium">'.$langs->trans("Date").'</span> : <span class="info-box-label">'.dol_print_date($this->db->jdate($this->datep), 'day').'</span>';
|
||||
}
|
||||
if (property_exists($this, 'type_payment') && !empty($this->type_payment)) {
|
||||
$return .= '<br><span class="opacitymedium">'.$langs->trans("Payment", $this->type_payment).'</span> : <span class="info-box-label">'.$this->type_payment.'</span>';
|
||||
}
|
||||
if (property_exists($this, 'accountancy_code')) {
|
||||
$return .= '<br><span class="opacitymedium">'.$langs->trans("Account").'</span> : <span class="info-box-label" title="'.$this->accountancy_code.'">'.$this->accountancy_code.'</span>';
|
||||
}
|
||||
if (property_exists($this, 'amount')) {
|
||||
$return .= '<br><span class="opacitymedium">'.$langs->trans("Debit").'</span> : <span class="info-box-label amount">'.price($this->amount).'</span>';
|
||||
}
|
||||
$return .= '</div>';
|
||||
$return .= '</div>';
|
||||
$return .= '</div>';
|
||||
return $return;
|
||||
}
|
||||
}
|
||||
|
||||
@ -45,6 +45,7 @@ if ($user->socid) {
|
||||
}
|
||||
|
||||
$optioncss = GETPOST('optioncss', 'alpha');
|
||||
$mode = GETPOST('mode', 'alpha');
|
||||
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$search_ref = GETPOST('search_ref', 'int');
|
||||
@ -312,6 +313,9 @@ if ($resql) {
|
||||
$total = 0;
|
||||
|
||||
$param = '';
|
||||
if (!empty($mode)) {
|
||||
$param .= '&mode='.urlencode($mode);
|
||||
}
|
||||
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
|
||||
$param .= '&contextpage='.urlencode($contextpage);
|
||||
}
|
||||
@ -362,7 +366,10 @@ if ($resql) {
|
||||
if (!empty($socid)) {
|
||||
$url .= '&socid='.urlencode($socid);
|
||||
}
|
||||
$newcardbutton = dolGetButtonTitle($langs->trans('MenuNewVariousPayment'), '', 'fa fa-plus-circle', $url, '', $user->rights->banque->modifier);
|
||||
$newcardbutton = '';
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition'));
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition'));
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('MenuNewVariousPayment'), '', 'fa fa-plus-circle', $url, '', $user->rights->banque->modifier);
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
|
||||
@ -375,6 +382,8 @@ if ($resql) {
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
||||
print '<input type="hidden" name="mode" value="'.$mode.'">';
|
||||
|
||||
|
||||
print_barre_liste($langs->trans("MenuVariousPayment"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'object_payment', 0, $newcardbutton, '', $limit, 0, 0, 1);
|
||||
|
||||
@ -568,166 +577,187 @@ if ($resql) {
|
||||
$variousstatic->id = $obj->rowid;
|
||||
$variousstatic->ref = $obj->rowid;
|
||||
$variousstatic->label = $obj->label;
|
||||
$variousstatic->datep = $obj->datep;
|
||||
$variousstatic->type_payment = $obj->payment_code;
|
||||
$bankline->fetch($obj->fk_bank);
|
||||
$variousstatic->fk_bank = $bankline->getNomUrl(1);
|
||||
$variousstatic->amount = $obj->amount;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
$accountingaccount->fetch('', $obj->accountancy_code, 1);
|
||||
$variousstatic->accountancy_code = $accountingaccount->getNomUrl(0, 0, 1, $obj->accountingaccount, 1);
|
||||
|
||||
// No
|
||||
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) {
|
||||
print '<td>'.(($offset * $limit) + $i).'</td>';
|
||||
}
|
||||
|
||||
// Ref
|
||||
if ($arrayfields['ref']['checked']) {
|
||||
print '<td>'.$variousstatic->getNomUrl(1)."</td>";
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
if ($mode == 'kanban') {
|
||||
if ($i == 0) {
|
||||
print '<tr><td colspan="12">';
|
||||
print '<div class="box-flex-container">';
|
||||
}
|
||||
}
|
||||
// Output Kanban
|
||||
|
||||
// Label payment
|
||||
if ($arrayfields['label']['checked']) {
|
||||
print '<td class="tdoverflowmax150" title="'.$variousstatic->label.'">'.$variousstatic->label."</td>";
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
print $variousstatic->getKanbanView('');
|
||||
if ($i == (min($num, $limit) - 1)) {
|
||||
print '</div>';
|
||||
print '</td></tr>';
|
||||
}
|
||||
}
|
||||
} else {
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
// Date payment
|
||||
if ($arrayfields['datep']['checked']) {
|
||||
print '<td class="center">'.dol_print_date($obj->datep, 'day')."</td>";
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
// No
|
||||
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) {
|
||||
print '<td>'.(($offset * $limit) + $i).'</td>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Date value
|
||||
if ($arrayfields['datev']['checked']) {
|
||||
print '<td class="center">'.dol_print_date($obj->datev, 'day')."</td>";
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
|
||||
// Type
|
||||
if ($arrayfields['type']['checked']) {
|
||||
print '<td class="center">';
|
||||
if ($obj->payment_code) {
|
||||
print $langs->trans("PaymentTypeShort".$obj->payment_code);
|
||||
print ' ';
|
||||
}
|
||||
print $obj->num_payment;
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
|
||||
// Project
|
||||
if ($arrayfields['project']['checked']) {
|
||||
print '<td class="nowraponall">';
|
||||
if ($obj->fk_project > 0) {
|
||||
$proj->fetch($obj->fk_project);
|
||||
print $proj->getNomUrl(1);
|
||||
}
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
|
||||
// Bank account
|
||||
if ($arrayfields['bank']['checked']) {
|
||||
print '<td class="nowraponall">';
|
||||
if ($obj->bid > 0) {
|
||||
$accountstatic->id = $obj->bid;
|
||||
$accountstatic->ref = $obj->bref;
|
||||
$accountstatic->number = $obj->bnumber;
|
||||
|
||||
if (isModEnabled('accounting')) {
|
||||
$accountstatic->account_number = $obj->bank_account_number;
|
||||
$accountingjournal->fetch($obj->accountancy_journal);
|
||||
$accountstatic->accountancy_journal = $accountingjournal->getNomUrl(0, 1, 1, '', 1);
|
||||
// Ref
|
||||
if ($arrayfields['ref']['checked']) {
|
||||
print '<td>'.$variousstatic->getNomUrl(1)."</td>";
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
$accountstatic->label = $obj->blabel;
|
||||
print $accountstatic->getNomUrl(1);
|
||||
} else {
|
||||
print ' ';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// Label payment
|
||||
if ($arrayfields['label']['checked']) {
|
||||
print '<td class="tdoverflowmax150" title="'.$variousstatic->label.'">'.$variousstatic->label."</td>";
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
|
||||
// Date payment
|
||||
if ($arrayfields['datep']['checked']) {
|
||||
print '<td class="center">'.dol_print_date($obj->datep, 'day')."</td>";
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Date value
|
||||
if ($arrayfields['datev']['checked']) {
|
||||
print '<td class="center">'.dol_print_date($obj->datev, 'day')."</td>";
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
|
||||
// Type
|
||||
if ($arrayfields['type']['checked']) {
|
||||
print '<td class="center">';
|
||||
if ($obj->payment_code) {
|
||||
print $langs->trans("PaymentTypeShort".$obj->payment_code);
|
||||
print ' ';
|
||||
}
|
||||
print $obj->num_payment;
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
|
||||
// Project
|
||||
if ($arrayfields['project']['checked']) {
|
||||
print '<td class="nowraponall">';
|
||||
if ($obj->fk_project > 0) {
|
||||
$proj->fetch($obj->fk_project);
|
||||
print $proj->getNomUrl(1);
|
||||
}
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
|
||||
// Bank account
|
||||
if ($arrayfields['bank']['checked']) {
|
||||
print '<td class="nowraponall">';
|
||||
if ($obj->bid > 0) {
|
||||
$accountstatic->id = $obj->bid;
|
||||
$accountstatic->ref = $obj->bref;
|
||||
$accountstatic->number = $obj->bnumber;
|
||||
|
||||
if (isModEnabled('accounting')) {
|
||||
$accountstatic->account_number = $obj->bank_account_number;
|
||||
$accountingjournal->fetch($obj->accountancy_journal);
|
||||
$accountstatic->accountancy_journal = $accountingjournal->getNomUrl(0, 1, 1, '', 1);
|
||||
}
|
||||
|
||||
$accountstatic->label = $obj->blabel;
|
||||
print $accountstatic->getNomUrl(1);
|
||||
} else {
|
||||
print ' ';
|
||||
}
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
|
||||
// Bank entry
|
||||
if ($arrayfields['entry']['checked']) {
|
||||
$bankline->fetch($obj->fk_bank);
|
||||
print '<td>'.$bankline->getNomUrl(1).'</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
|
||||
// Accounting account
|
||||
if (!empty($arrayfields['account']['checked'])) {
|
||||
$accountingaccount->fetch('', $obj->accountancy_code, 1);
|
||||
|
||||
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->accountancy_code.' '.$accountingaccount->label).'">'.$accountingaccount->getNomUrl(0, 1, 1, '', 1).'</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
|
||||
// Accounting subledger account
|
||||
if (!empty($arrayfields['subledger']['checked'])) {
|
||||
print '<td class="tdoverflowmax150">'.length_accounta($obj->subledger_account).'</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
|
||||
// Debit
|
||||
if ($arrayfields['debit']['checked']) {
|
||||
print '<td class="nowrap right">';
|
||||
if ($obj->sens == 0) {
|
||||
print '<span class="amount">'.price($obj->amount).'</span>';
|
||||
$totalarray['val']['total_deb'] += $obj->amount;
|
||||
}
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!$i) {
|
||||
$totalarray['pos'][$totalarray['nbfield']] = 'total_deb';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Credit
|
||||
if ($arrayfields['credit']['checked']) {
|
||||
print '<td class="nowrap right">';
|
||||
if ($obj->sens == 1) {
|
||||
print '<span class="amount">'.price($obj->amount).'</span>';
|
||||
$totalarray['val']['total_cred'] += $obj->amount;
|
||||
}
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!$i) {
|
||||
$totalarray['pos'][$totalarray['nbfield']] = 'total_cred';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
print '<td></td>';
|
||||
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
print '</tr>'."\n";
|
||||
}
|
||||
|
||||
// Bank entry
|
||||
if ($arrayfields['entry']['checked']) {
|
||||
$bankline->fetch($obj->fk_bank);
|
||||
print '<td>'.$bankline->getNomUrl(1).'</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
|
||||
// Accounting account
|
||||
if (!empty($arrayfields['account']['checked'])) {
|
||||
$accountingaccount->fetch('', $obj->accountancy_code, 1);
|
||||
|
||||
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->accountancy_code.' '.$accountingaccount->label).'">'.$accountingaccount->getNomUrl(0, 1, 1, '', 1).'</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
|
||||
// Accounting subledger account
|
||||
if (!empty($arrayfields['subledger']['checked'])) {
|
||||
print '<td class="tdoverflowmax150">'.length_accounta($obj->subledger_account).'</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
|
||||
// Debit
|
||||
if ($arrayfields['debit']['checked']) {
|
||||
print '<td class="nowrap right">';
|
||||
if ($obj->sens == 0) {
|
||||
print '<span class="amount">'.price($obj->amount).'</span>';
|
||||
$totalarray['val']['total_deb'] += $obj->amount;
|
||||
}
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!$i) {
|
||||
$totalarray['pos'][$totalarray['nbfield']] = 'total_deb';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Credit
|
||||
if ($arrayfields['credit']['checked']) {
|
||||
print '<td class="nowrap right">';
|
||||
if ($obj->sens == 1) {
|
||||
print '<span class="amount">'.price($obj->amount).'</span>';
|
||||
$totalarray['val']['total_cred'] += $obj->amount;
|
||||
}
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!$i) {
|
||||
$totalarray['pos'][$totalarray['nbfield']] = 'total_cred';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
print '<td></td>';
|
||||
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
print '</tr>'."\n";
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user