Add php files
This commit is contained in:
@@ -0,0 +1,134 @@
|
||||
<?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 MyEcmTransactionsDashlet 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 . '"',
|
||||
|
||||
$lvsParams = array(
|
||||
'custom_select' => '',
|
||||
'custom_from' => '',
|
||||
'custom_where' => ' and ecmtransactions.settled=0 and ecmtransactions.type3=1 ',
|
||||
'distinct' => true
|
||||
);
|
||||
|
||||
$dane=parent::process($lvsParams);
|
||||
$sumaw=0;
|
||||
for($i=0;$i<count($dane['data']);$i++){
|
||||
$sumaw+=$dane['data'][$i]['VALUE'];
|
||||
}
|
||||
// echo $sumaw;
|
||||
$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 MyEcmTransactionsDashlet($id, $def = null) {
|
||||
|
||||
$this->sumap='Suma: '.$sumaw;
|
||||
///echo $sum.'aa';
|
||||
global $current_user, $app_strings;
|
||||
// require_once('MyEcmTransactionsDashletOptions.tpl');
|
||||
// Uncomment line below if you don't want dashlet restricted to items you own
|
||||
// $def = array( 'myItemsOnly' => false );
|
||||
$def['extabutton']=1;
|
||||
parent::DashletGeneric($id, $def);
|
||||
//echo $id;
|
||||
if(empty($def['title'])) $this->title = 'Wychodzą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;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user