135 lines
6.3 KiB
PHP
Executable File
135 lines
6.3 KiB
PHP
Executable File
<?php
|
|
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
|
/*********************************************************************************
|
|
* Skeleton Task Dashlet
|
|
*
|
|
* Author: Blake Robertson
|
|
* Date: December 15th, 2010
|
|
*
|
|
* How to use this file...
|
|
* - Change anywhere the text skeleton (two occurances class name and constructor name)
|
|
* - Change anywhere CHANGEME appears to the appropriate values.
|
|
* - Customize the where
|
|
*
|
|
********************************************************************************/
|
|
|
|
require_once('include/Dashlets/DashletGeneric.php');
|
|
global $sumaw;
|
|
|
|
class MyEcmTransactionsDashlet2 extends DashletGeneric {
|
|
function process() {
|
|
global $current_language, $app_list_strings, $image_path, $current_user;
|
|
|
|
|
|
// NOTE: date_*_flag = 1 when the date is NULL which is the opposite you'd think...
|
|
|
|
// DATES Past Start Date
|
|
// 'custom_where' => ' AND ((Date(tasks.date_start) <= Date(Now())) OR (tasks.date_start_flag=1)))',
|
|
|
|
// OVERDUE TASKS
|
|
// 'custom_where' => ' AND ((Date(tasks.date_start) <= Date(Now()) AND (tasks.date_due_flag=1)) OR (Date(tasks.date_due) <= Date(Now())) )',
|
|
|
|
// Tasks assigned to me by other people!
|
|
// Other changes, show the column "Created By" instead of Start Date.
|
|
// 'custom_where' => ' AND tasks.created_by != "' . $current_user->id . '"',
|
|
|
|
// Tasks I created for other people.
|
|
// Other changes, show the column assigned_to instead of start date., uncheck the "My Items" by default
|
|
// 'custom_where' => ' AND tasks.created_by = "' . $current_user->id . '" AND tasks.assigned_user_id != "' . $current_user->id . '"',
|
|
$date = new DateTime(date('Y-m-d', time()));
|
|
$d=$date->format('Y-m-d');
|
|
$date->modify('+5 days');
|
|
$d2=$date->format('Y-m-d');
|
|
$lvsParams = array(
|
|
'custom_select' => '',
|
|
'custom_from' => ' inner join accounts aa on aa.id=ecmtransactions.parent_id',
|
|
'custom_where' => ' and ecmtransactions.settled=0 and aa.account_type="rec"',
|
|
'distinct' => true
|
|
);
|
|
|
|
$dane=parent::process($lvsParams);
|
|
$sumaw=0;
|
|
for($i=0;$i<count($dane['data']);$i++){
|
|
$sumaw+=$dane['data'][$i]['VALUE'];
|
|
}
|
|
$this->sumap='<table style="width:276px;"><tr><td style="width:106px;">Suma:</td><td style="width:170px;text-align:right;"><b>'.number_format($sumaw,2,",",".").'</b></td></tr></table>';
|
|
$lvsParams['overrideOrder'] = true;
|
|
$lvsParams['orderBy'] = 'payment_date';
|
|
$lvsParams['sortOrder'] = 'ASC';
|
|
$dane=parent::process($lvsParams);
|
|
}
|
|
|
|
function MyEcmTransactionsDashlet2($id, $def = null) {
|
|
|
|
//$this->sumap='Suma: '.$sumaw;
|
|
//echo $sum;
|
|
global $current_user, $app_strings;
|
|
// require_once('MyEcmTransactionsDashlet2Options.tpl');
|
|
// Uncomment line below if you don't want dashlet restricted to items you own
|
|
// $def = array( 'myItemsOnly' => false );
|
|
parent::DashletGeneric($id, $def);
|
|
|
|
if(empty($def['title'])) $this->title = 'Przychodzące płatności';
|
|
|
|
// This is the filter criteria, it's usually in a .data.php file, i moved it here so i'd have less files to modify.
|
|
$this->searchFields = array('name' => array('default' => ''),
|
|
// 'priority' => array('default' => ''),
|
|
'type' => array('default' => array('1', '0')),
|
|
'payment_date' => array('default' => ''),
|
|
|
|
|
|
'status' => array('default' => ''),
|
|
// 'team_id' => array('default' => '', 'label' => 'LBL_TEAMS'),
|
|
'assigned_user_id' => array('type' => 'assigned_user_name',
|
|
'label' => 'LBL_ASSIGNED_TO' )
|
|
|
|
);
|
|
// 'default' => $current_user->name
|
|
if(empty($def['filters'])){
|
|
if(isset($this->searchFields['status'])){
|
|
if(!empty($this->searchFields['status']['default'])){
|
|
$this->filters['status'] = $this->searchFields['status']['default'];
|
|
}
|
|
}
|
|
}
|
|
|
|
// This is the columns that show up in the list view, customize accordinly.
|
|
$this->columns = array(
|
|
'name' => array('width' => '8',
|
|
'label' => 'LBL_SUBJECT',
|
|
'link' => true,
|
|
'default' => true),
|
|
'value' => array('width' => '8',
|
|
'label' => 'Kwota',
|
|
'align'=>'right',
|
|
|
|
'default' => true),
|
|
'parent_id'=>array(
|
|
'width'=>0,
|
|
'label'=>' ',
|
|
'customCode'=>' ',
|
|
'default'=>true,
|
|
'sortable'=>false,
|
|
),
|
|
'parent_name' => array(
|
|
'width' => '20',
|
|
'label' => 'Konrahent',
|
|
'default' => true,
|
|
'id'=>'parent_id',
|
|
'module'=>'Accounts',
|
|
'link'=>true),
|
|
'payment_date' => array('width' => '8',
|
|
'label' => 'Termin płatności',
|
|
'default' => true),
|
|
'options' => array('width' => '2',
|
|
'label' => 'Opcje',
|
|
'default' => true),
|
|
);
|
|
|
|
$this->seedBean = new EcmTransaction();
|
|
$this->lvs->quickViewLinks = false;
|
|
|
|
}
|
|
|
|
}
|
|
?>
|