更新到 5.2 后第一次 SVN 提交。

yuchenghu@hawebs.net



git-svn-id: https://svn.code.sf.net/p/hawebs/svn@533 a2543c7e-f6e9-4f8a-8bff-1ffc34733512
This commit is contained in:
YuCheng Hu
2010-08-21 14:14:23 +00:00
parent 5a39736f94
commit f5febb8080
18 changed files with 505 additions and 219 deletions
@@ -41,6 +41,16 @@ if($singlepane_view == 'true' && $_REQUEST['action'] == 'CallRelatedList') {
if (isset($focus->name)) $smarty->assign("NAME", $focus->name);
$related_array=getRelatedLists($currentModule,$focus);
$smarty->assign("RELATEDLISTS", $related_array);
require_once('include/ListView/RelatedListViewSession.php');
if(!empty($_REQUEST['selected_header']) && !empty($_REQUEST['relation_id'])) {
$relationId = vtlib_purify($_REQUEST['relation_id']);
RelatedListViewSession::addRelatedModuleToSession($relationId,
vtlib_purify($_REQUEST['selected_header']));
}
$open_related_modules = RelatedListViewSession::getRelatedModulesFromSession();
$smarty->assign("SELECTEDHEADERS", $open_related_modules);
$smarty->assign("TODO_PERMISSION",CheckFieldPermission('parent_id','Calendar'));
$smarty->assign("EVENT_PERMISSION",CheckFieldPermission('parent_id','Events'));
$smarty->assign("CATEGORY",$category);
@@ -8,12 +8,11 @@
* All Rights Reserved.
*
********************************************************************************/
include_once 'modules/SalesOrder/SalesOrderPDFController.php';
$controller = new Vtiger_SalesOrderPDFController($currentModule);
$controller->loadRecord(vtlib_purify($_REQUEST['record']));
include('include/InventoryPDF.php');
$pdf=get_so_pdf();
$pdf->Output('SalesOrder.pdf','D'); //added file name to make it work in IE, also forces the download giving the user the option to save
$controller->Output('SalesOrder.pdf', 'D');//added file name to make it work in IE, also forces the download giving the user the option to save
exit();
?>
@@ -35,5 +35,7 @@ if(!isset($_REQUEST['record']))
DeleteEntity($_REQUEST['module'],$_REQUEST['return_module'],$focus,$_REQUEST['record'],$_REQUEST['return_id']);
$parenttab = getParentTab();
header("Location: index.php?module=".vtlib_purify($_REQUEST['return_module'])."&action=".vtlib_purify($_REQUEST['return_action'])."&smodule=SO&parenttab=$parenttab&record=".vtlib_purify($_REQUEST['return_id'])."&relmodule=".vtlib_purify($_REQUEST['module']).$url);
header("Location: index.php?module=".vtlib_purify($_REQUEST['return_module'])."&action=".
vtlib_purify($_REQUEST['return_action'])."&&parenttab=$parenttab&record=".
vtlib_purify($_REQUEST['return_id']).$url);
?>
@@ -114,6 +114,14 @@ if($singlepane_view == 'true')
{
$related_array = getRelatedLists($currentModule,$focus);
$smarty->assign("RELATEDLISTS", $related_array);
require_once('include/ListView/RelatedListViewSession.php');
if(!empty($_REQUEST['selected_header']) && !empty($_REQUEST['relation_id'])) {
RelatedListViewSession::addRelatedModuleToSession(vtlib_purify($_REQUEST['relation_id']),
vtlib_purify($_REQUEST['selected_header']));
}
$open_related_modules = RelatedListViewSession::getRelatedModulesFromSession();
$smarty->assign("SELECTEDHEADERS", $open_related_modules);
}
$smarty->assign("SinglePane_View", $singlepane_view);
@@ -126,6 +134,12 @@ if(PerformancePrefs::getBoolean('DETAILVIEW_RECORD_NAVIGATION', true) && isset($
$focus->markAsViewed($current_user->id);
// END
// Gather the custom link information to display
include_once('vtlib/Vtiger/Link.php');
$customlink_params = Array('MODULE'=>$currentModule, 'RECORD'=>$focus->id, 'ACTION'=>vtlib_purify($_REQUEST['action']));
$smarty->assign('CUSTOM_LINKS', Vtiger_Link::getAllByType(getTabid($currentModule), Array('DETAILVIEWBASIC','DETAILVIEW','DETAILVIEWWIDGET'), $customlink_params));
// END
$smarty->assign('DETAILVIEW_AJAX_EDIT', PerformancePrefs::getBoolean('DETAILVIEW_AJAX_EDIT', true));
$smarty->display("Inventory/InventoryDetailView.tpl");
@@ -41,5 +41,7 @@ if($ajaxaction == "DETAILVIEW")
{
echo ":#:FAILURE";
}
}elseif($ajaxaction == "LOADRELATEDLIST" || $ajaxaction == "DISABLEMODULE") {
require_once 'include/ListView/RelatedListViewContents.php';
}
?>
@@ -47,7 +47,7 @@ if (isset ($_REQUEST['record']) && $_REQUEST['record'] != '') {
$quote_focus->id = $quoteid;
$quote_focus->retrieve_entity_info($quoteid, "Quotes");
$focus = getConvertQuoteToSoObject($focus, $quote_focus, $quoteid);
$focus->id = $quoteid;
// Reset the value w.r.t Quote Selected
$currencyid = $quote_focus->column_fields['currency_id'];
@@ -75,7 +75,7 @@ if (isset ($_REQUEST['record']) && $_REQUEST['record'] != '') {
//Handling for dateformat in due_date vtiger_field
if ($focus->column_fields['duedate'] != '') {
$curr_due_date = $focus->column_fields['duedate'];
$focus->column_fields['duedate'] = getDBInsertDateValue($curr_due_date);
$focus->column_fields['duedate'] = getValidDBInsertDateValue($curr_due_date);
}
$quoteid = $focus->column_fields['quote_id'];
@@ -111,7 +111,7 @@ if (isset ($_REQUEST['record']) && $_REQUEST['record'] != '') {
//Handling for dateformat in due_date vtiger_field
if ($focus->column_fields['duedate'] != '') {
$curr_due_date = $focus->column_fields['duedate'];
$focus->column_fields['duedate'] = getDBInsertDateValue($curr_due_date);
$focus->column_fields['duedate'] = getValidDBInsertDateValue($curr_due_date);
}
$quoteid = $focus->column_fields['quote_id'];
$quote_focus = new Quotes();
@@ -360,4 +360,4 @@ if ($focus->mode == 'edit')
$smarty->display("Inventory/InventoryEditView.tpl");
else
$smarty->display('Inventory/InventoryCreateView.tpl');
?>
?>
@@ -52,10 +52,34 @@ function getTopSalesOrder($maxval,$calCnt)
//Retreive the list from Database
//<<<<<<<<<customview>>>>>>>>>
$date_var = date('Y-m-d');
$currentModule = 'SalesOrder';
$viewId = getCvIdOfAll($currentModule);
$queryGenerator = new QueryGenerator($currentModule, $current_user);
$queryGenerator->initForCustomViewById($viewId);
$meta = $queryGenerator->getMeta($currentModule);
$accessibleFieldNameList = array_keys($meta->getModuleFields());
$customViewFields = $queryGenerator->getCustomViewFields();
$fields = $queryGenerator->getFields();
$newFields = array_diff($fields, $customViewFields);
$widgetFieldsList = array('subject','account_id','quote_id','contact_id','total');
$widgetFieldsList = array_intersect($accessibleFieldNameList, $widgetFieldsList);
$widgetSelectedFields = array_chunk(array_intersect($customViewFields, $widgetFieldsList), 2);
//select the first chunk of two fields
$widgetSelectedFields = $widgetSelectedFields[0];
if(count($widgetSelectedFields) < 2) {
$widgetSelectedFields = array_chunk(array_merge($widgetSelectedFields, $accessibleFieldNameList), 2);
//select the first chunk of two fields
$widgetSelectedFields = $widgetSelectedFields[0];
}
$newFields = array_merge($newFields, $widgetSelectedFields);
$queryGenerator->setFields($newFields);
$_REQUEST = getTopSalesOrderSearch($_REQUEST, array(
'assigned_user_id'=>$current_user->column_fields['user_name'],
'duedate'=>$date_var));
$queryGenerator->addUserSearchConditions($_REQUEST);
$search_qry = '&query=true'.getSearchURL($_REQUEST);
$query = $queryGenerator->getQuery();
$where = ' and vtiger_crmentity.smownerid='.$current_user->id.' and vtiger_salesorder.duedate >= \''.$date_var.'\'';
$query = getListQuery("SalesOrder",$where);
$query .=" ORDER BY total DESC";
//<<<<<<<<customview>>>>>>>>>
$query .= " LIMIT " . $adb->sql_escape_string($maxval);
@@ -114,19 +138,31 @@ function getTopSalesOrder($maxval,$calCnt)
//Retreive the List View Table Header
$title=array('myTopSalesOrders.gif',$current_module_strings['LBL_MY_TOP_SO'],'home_mytopso');
$listview_header = getListViewHeader($focus,"SalesOrder",$url_string,$sorder,$order_by,"HomePage",$oCustomView);
$header = Array($listview_header[1],$listview_header[2]);
$controller = new ListViewController($adb, $current_user, $queryGenerator);
$controller->setHeaderSorting(false);
$header = $controller->getListViewHeader($focus,$currentModule,$url_string,$sorder,
$order_by, true);
$listview_entries = getListViewEntries($focus,"SalesOrder",$list_result,$navigation_array,"HomePage","","EditView","Delete",$oCustomView);
foreach($listview_entries as $crmid=>$valuearray)
{
$entries[$crmid] = Array($valuearray[1],$valuearray[2]);
}
$search_qry = "&query=true&Fields0=vtiger_salesorder.duedate&Condition0=grteq&Srch_value0=".$date_var."&Fields1=vtiger_crmentity.smownerid&Condition1=is&Srch_value1=".$current_user->column_fields['user_name']."&searchtype=advance&search_cnt=2&matchtype=all";
$entries = $controller->getListViewEntries($focus,$currentModule,$list_result,
$navigation_array, true);
$values=Array('ModuleName'=>'SalesOrder','Title'=>$title,'Header'=>$header,'Entries'=>$entries,'search_qry'=>$search_qry);
if ( ($display_empty_home_blocks && $noofrows == 0 ) || ($noofrows>0) )
return $values;
}
?>
function getTopSalesOrderSearch($output, $input) {
$output['query'] = 'true';
$output['Fields0'] = 'duedate';
$output['Condition0'] = 'h';
$output['Srch_value0'] = $input['duedate'];
$output['Fields1'] = 'assigned_user_id';
$output['Condition1'] = 'e';
$output['Srch_value1'] = $input['assigned_user_id'];
$output['searchtype'] = 'advance';
$output['search_cnt'] = '2';
$output['matchtype'] = 'all';
return $output;
}
?>
@@ -61,18 +61,6 @@ $_SESSION['SALESORDER_ORDER_BY'] = $order_by;
$_SESSION['SALESORDER_SORT_ORDER'] = $sorder;
//<<<<<<<<<<<<<<<<<<< sorting - stored in session >>>>>>>>>>>>>>>>>>>>
if(isset($_REQUEST['query']) && $_REQUEST['query'] != '' && $_REQUEST['query'] == 'true')
{
list($where, $ustring) = split("#@@#",getWhereCondition($currentModule));
// we have a query
$url_string .="&query=true".$ustring;
$log->info("Here is the where clause for the list view: $where");
$smarty->assign("SEARCH_URL",$url_string);
}
//<<<<cutomview>>>>>>>
$oCustomView = new CustomView("SalesOrder");
$viewid = $oCustomView->getViewId($currentModule);
@@ -108,21 +96,26 @@ if($viewnamedesc['viewname'] == 'All')
}
//<<<<<<<<<customview>>>>>>>>>
if($viewid != "0")
{
$listquery = getListQuery("SalesOrder");
$list_query = $oCustomView->getModifiedCvListQuery($viewid,$listquery,"SalesOrder");
}else
{
$list_query = getListQuery("SalesOrder");
global $current_user;
$queryGenerator = new QueryGenerator($currentModule, $current_user);
if ($viewid != "0") {
$queryGenerator->initForCustomViewById($viewid);
} else {
$queryGenerator->initForDefaultCustomView();
}
//<<<<<<<<customview>>>>>>>>>
if(isset($where) && $where != '')
{
$list_query .= ' and '.$where;
// Enabling Module Search
$url_string = '';
if($_REQUEST['query'] == 'true') {
$queryGenerator->addUserSearchConditions($_REQUEST);
$ustring = getSearchURL($_REQUEST);
$url_string .= "&query=true$ustring";
$smarty->assign('SEARCH_URL', $url_string);
}
$list_query = $queryGenerator->getQuery();
if(isset($order_by) && $order_by != '')
{
if($order_by == 'smownerid')
@@ -164,20 +157,23 @@ if( $adb->dbType == "pgsql")
else
$list_result = $adb->pquery($list_query. " LIMIT $limit_start_rec, $list_max_entries_per_page", array());
$recordListRangeMsg = getRecordRangeMessage($list_result, $limit_start_rec);
$recordListRangeMsg = getRecordRangeMessage($list_result, $limit_start_rec,$noofrows);
$smarty->assign('recordListRange',$recordListRangeMsg);
//Retreive the List View Table Header
if($viewid !='')
$url_string .="&viewname=".$viewid;
$listview_header = getListViewHeader($focus,"SalesOrder",$url_string,$sorder,$order_by,"",$oCustomView);
$controller = new ListViewController($adb, $current_user, $queryGenerator);
$listview_header = $controller->getListViewHeader($focus,$currentModule,$url_string,$sorder,
$order_by);
$smarty->assign("LISTHEADER", $listview_header);
$listview_header_search=getSearchListHeaderValues($focus,"SalesOrder",$url_string,$sorder,$order_by,"",$oCustomView);
$listview_header_search = $controller->getBasicSearchFieldInfoList();
$smarty->assign("SEARCHLISTHEADER", $listview_header_search);
$listview_entries = getListViewEntries($focus,"SalesOrder",$list_result,$navigation_array,'','&return_module=SalesOrder&return_action=index','EditView','Delete',$oCustomView);
$listview_entries = $controller->getListViewEntries($focus,$currentModule,$list_result,
$navigation_array);
$smarty->assign("LISTENTITY", $listview_entries);
$smarty->assign("SELECT_SCRIPT", $view_script);
@@ -188,7 +184,7 @@ $smarty->assign("CURRENT_PAGE_BOXES", implode(array_keys($listview_entries),";")
$navigationOutput = getTableHeaderSimpleNavigation($navigation_array, $url_string,"SalesOrder",'index',$viewid);
$alphabetical = AlphabeticalSearch($currentModule,'index','subject','true','basic',"","","","",$viewid);
$fieldnames = getAdvSearchfields($module);
$fieldnames = $controller->getAdvancedSearchOptionString();
$criteria = getcriteria_options();
$smarty->assign("CRITERIA", $criteria);
$smarty->assign("FIELDNAMES", $fieldnames);
@@ -203,6 +199,12 @@ $smarty->assign("CHECK", $check_button);
$_SESSION[$currentModule.'_listquery'] = $list_query;
// Gather the custom link information to display
include_once('vtlib/Vtiger/Link.php');
$customlink_params = Array('MODULE'=>$currentModule, 'ACTION'=>vtlib_purify($_REQUEST['action']), 'CATEGORY'=> $category);
$smarty->assign('CUSTOM_LINKS', Vtiger_Link::getAllByType(getTabid($currentModule), Array('LISTVIEWBASIC','LISTVIEW'), $customlink_params));
// END
if(isset($_REQUEST['ajax']) && $_REQUEST['ajax'] != '')
$smarty->display("ListViewEntries.tpl");
else
@@ -130,7 +130,7 @@ class SalesOrder extends CRMEntity {
if($_REQUEST['action'] != 'SalesOrderAjax' && $_REQUEST['ajxaction'] != 'DETAILVIEW' && $_REQUEST['action'] != 'MassEditSave')
{
//Based on the total Number of rows we will save the product relationship with this entity
saveInventoryProductDetails(&$this, 'SalesOrder');
saveInventoryProductDetails($this, 'SalesOrder');
}
// Update the currency id and the conversion rate for the sales order
@@ -352,6 +352,9 @@ class SalesOrder extends CRMEntity {
left join vtiger_salesordercf on vtiger_salesorder.salesorderid = vtiger_salesordercf.salesorderid
left join vtiger_sobillads on vtiger_salesorder.salesorderid=vtiger_sobillads.sobilladdressid
left join vtiger_soshipads on vtiger_salesorder.salesorderid=vtiger_soshipads.soshipaddressid
left join vtiger_inventoryproductrel as vtiger_inventoryproductrelSalesOrder on vtiger_salesorder.salesorderid = vtiger_inventoryproductrelSalesOrder.id
left join vtiger_products as vtiger_productsSalesOrder on vtiger_productsSalesOrder.productid = vtiger_inventoryproductrelSalesOrder.productid
left join vtiger_service as vtiger_serviceSalesOrder on vtiger_serviceSalesOrder.serviceid = vtiger_inventoryproductrelSalesOrder.productid
left join vtiger_groups as vtiger_groupsSalesOrder on vtiger_groupsSalesOrder.groupid = vtiger_crmentitySalesOrder.smownerid
left join vtiger_users as vtiger_usersSalesOrder on vtiger_usersSalesOrder.id = vtiger_crmentitySalesOrder.smownerid
left join vtiger_potential as vtiger_potentialRelSalesOrder on vtiger_potentialRelSalesOrder.potentialid = vtiger_salesorder.potentialid
@@ -403,6 +406,12 @@ class SalesOrder extends CRMEntity {
}
}
public function getJoinClause($tableName) {
if ($tableName == 'vtiger_invoice_recurring_info') {
return 'LEFT JOIN';
}
return parent::getJoinClause($tableName);
}
}
?>
@@ -0,0 +1,80 @@
<?php
/*+**********************************************************************************
* The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
************************************************************************************/
include_once 'include/InventoryPDFController.php';
include_once dirname(__FILE__). '/SalesOrderPDFHeaderViewer.php';
class Vtiger_SalesOrderPDFController extends Vtiger_InventoryPDFController{
function buildHeaderModelTitle() {
return sprintf("%s: %s", rtrim($this->moduleName, 's'), $this->focusColumnValue('salesorder_no'));
}
function getHeaderViewer() {
$headerViewer = new SalesOrderPDFHeaderViewer();
$headerViewer->setModel($this->buildHeaderModel());
return $headerViewer;
}
function buildHeaderModelColumnLeft() {
$modelColumnLeft = parent::buildHeaderModelColumnLeft();
$modelColumnLeft['fieldlabel'] = getTranslatedString('Quote Name', $this->moduleName);
$modelColumnLeft['fieldvalue'] = $this->resolveReferenceLabel($this->focusColumnValue('quote_id'), 'Quotes');
return $modelColumnLeft;
}
function buildHeaderModelColumnCenter() {
$subject = $this->focusColumnValue('subject');
$customerName = $this->resolveReferenceLabel($this->focusColumnValue('account_id'), 'Accounts');
$contactName = $this->resolveReferenceLabel($this->focusColumnValue('contact_id'), 'Contacts');
$purchaseOrder = $this->focusColumnValue('vtiger_purchaseorder');
$subjectLabel = getTranslatedString('Subject', $this->moduleName);
$customerNameLabel = getTranslatedString('Customer Name', $this->moduleName);
$contactNameLabel = getTranslatedString('Contact Name', $this->moduleName);
$purchaseOrderLabel = getTranslatedString('Purchase Order', $this->moduleName);
$modelColumn1 = array(
$subjectLabel => $subject,
$customerNameLabel => $customerName,
$contactNameLabel => $contactName,
$purchaseOrderLabel => $purchaseOrder
);
return $modelColumn1;
}
function buildHeaderModelColumnRight() {
$issueDateLabel = getTranslatedString('Issued Date', $this->moduleName);
$validDateLabel = getTranslatedString('Due Date', $this->moduleName);
$billingAddressLabel = getTranslatedString('Billing Address', $this->moduleName);
$shippingAddressLabel = getTranslatedString('Shipping Address', $this->moduleName);
$modelColumn2 = array(
'dates' => array(
$issueDateLabel => $this->formatDate(date("Y-m-d")),
$validDateLabel => $this->formatDate($this->focusColumnValue('duedate')),
),
$billingAddressLabel => $this->buildHeaderBillingAddress(),
$shippingAddressLabel => $this->buildHeaderShippingAddress()
);
return $modelColumn2;
}
function getWatermarkContent() {
return $this->focusColumnValue('sostatus');
}
function buildFooterModel() {
$footerModel = new Vtiger_PDF_Model();
$termsconditionLabel = getTranslatedString('Order Notes', $this->moduleName);
$footerModel->set('title', $termsconditionLabel);
$footerModel->set('content', from_html($this->focusColumnValue("description")));
return $footerModel;
}
}
?>
@@ -0,0 +1,121 @@
<?php
/*+**********************************************************************************
* The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
************************************************************************************/
include_once 'vtlib/Vtiger/PDF/inventory/HeaderViewer.php';
class SalesOrderPDFHeaderViewer extends Vtiger_PDF_InventoryHeaderViewer {
function display($parent) {
$pdf = $parent->getPDF();
$headerFrame = $parent->getHeaderFrame();
if($this->model) {
$headerColumnWidth = $headerFrame->w/3.0;
$modelColumns = $this->model->get('columns');
// Column 1
$offsetX = 5;
$modelColumnLeft = $modelColumns[0];
$pdf->Image($modelColumnLeft['logo'], $headerFrame->x, $headerFrame->y);
list($imageWidth, $imageHeight, $imageType, $imageAttr) = getimagesize($modelColumnLeft['logo']);
$imageHeightInMM = ceil($imageHeight * 0.2645);
$pdf->SetFont('Droidsansfallback', 'B');
$contentHeight = $pdf->GetStringHeight( $modelColumnLeft['summary'], $headerColumnWidth);
$pdf->MultiCell($headerColumnWidth, $contentHeight, $modelColumnLeft['summary'], 0, 'L', 0, 1,
$headerFrame->x, $headerFrame->y+$imageHeightInMM+2);
$pdf->SetFont('Droidsansfallback', '');
$contentHeight = $pdf->GetStringHeight( $modelColumnLeft['content'], $headerColumnWidth);
$pdf->MultiCell($headerColumnWidth, $contentHeight, $modelColumnLeft['content'], 0, 'L', 0, 1,
$headerFrame->x, $pdf->GetY());
if(!empty($modelColumnLeft['fieldvalue'])) {
$pdf->SetFont('Droidsansfallback', 'B');
$pdf->SetFillColor(205,201,201);
$height = $pdf->GetStringHeight($modelColumnLeft['fieldlabel'], $headerColumnWidth);
$pdf->MultiCell($headerColumnWidth, 7, $modelColumnLeft['fieldlabel'], 1, 'C', 1, 1, $headerFrame->x, $pdf->GetY()+2);
$pdf->SetFont('Droidsansfallback', '');
$height = $pdf->GetStringHeight($modelColumnLeft['fieldvalue'], $headerColumnWidth);
$pdf->MultiCell($headerColumnWidth, 7, $modelColumnLeft['fieldvalue'], 1, 'C', 0, 1, $headerFrame->x, $pdf->GetY());
}
// Column 2
$offsetX = 5;
$pdf->SetY($headerFrame->y);
$modelColumnCenter = $modelColumns[1];
$offsetY = 8;
foreach($modelColumnCenter as $label => $value) {
if(!empty($value)) {
$pdf->SetFont('Droidsansfallback', 'B');
$pdf->SetFillColor(205,201,201);
$pdf->MultiCell($headerColumnWidth-$offsetX, 7, $label, 1, 'C', 1, 1, $headerFrame->x+$headerColumnWidth+$offsetX, $pdf->GetY()+$offsetY);
$pdf->SetFont('Droidsansfallback', '');
$pdf->MultiCell($headerColumnWidth-$offsetX, 7, $value, 1, 'C', 0, 1, $headerFrame->x+$headerColumnWidth+$offsetX, $pdf->GetY());
$offsetY = 2;
}
}
// Column 3
$offsetX = 10;
$modelColumnRight = $modelColumns[2];
$contentWidth = $pdf->GetStringWidth($this->model->get('title'));
$contentHeight = $pdf->GetStringHeight($this->model->get('title'), $contentWidth);
$roundedRectX = $headerFrame->w+$headerFrame->x-$contentWidth*2.0;
$roundedRectW = $contentWidth*2.0;
$pdf->RoundedRect($roundedRectX, 10, $roundedRectW, 10, 3, '1111', 'DF', array(), array(205,201,201));
$contentX = $roundedRectX + (($roundedRectW - $contentWidth)/2.0);
$pdf->SetFont('Droidsansfallback', 'B');
$pdf->MultiCell($contentWidth*2.0, $contentHeight, $this->model->get('title'), 0, 'R', 0, 1, $contentX-$contentWidth,
$headerFrame->y+1);
$offsetY = 2;
foreach($modelColumnRight as $label => $value) {
if(is_array($value)) {
$pdf->SetFont('Droidsansfallback', '');
foreach($value as $l => $v) {
$pdf->MultiCell($headerColumnWidth-$offsetX, 7, sprintf('%s: %s', $l, $v), 1, 'C', 0, 1,
$headerFrame->x+$headerColumnWidth*2.0+$offsetX, $pdf->GetY()+$offsetY);
$offsetY = 0;
}
} else {
$offsetY = 1;
$pdf->SetFont('Droidsansfallback', 'B');
$pdf->SetFillColor(205,201,201);
$pdf->MultiCell($headerColumnWidth-$offsetX, 7, $label, 1, 'L', 1, 1, $headerFrame->x+$headerColumnWidth*2.0+$offsetX,
$pdf->GetY()+$offsetY);
$pdf->SetFont('Droidsansfallback', '');
$pdf->MultiCell($headerColumnWidth-$offsetX, 7, $value, 1, 'L', 0, 1, $headerFrame->x+$headerColumnWidth*2.0+$offsetX,
$pdf->GetY());
}
}
$pdf->setFont('Droidsansfallback', '');
// Add the border cell at the end
// This is required to reset Y position for next write
$pdf->MultiCell($headerFrame->w, $headerFrame->h-$headerFrame->y, "", 0, 'L', 0, 1, $headerFrame->x, $headerFrame->y);
}
}
}
?>
+10 -4
View File
@@ -56,8 +56,14 @@ if(isset($_REQUEST['return_id']) && $_REQUEST['return_id'] != "") $return_id = v
$local_log->debug("Saved record with id of ".$return_id);
//code added for returning back to the current view after edit from list view
if($_REQUEST['return_viewname'] == '') $return_viewname='0';
if($_REQUEST['return_viewname'] != '')$return_viewname=vtlib_purify($_REQUEST['return_viewname']);
header("Location: index.php?action=$return_action&module=$return_module&parenttab=$parenttab&record=$return_id&viewname=$return_viewname&smodule=SO&start=".vtlib_purify($_REQUEST['pagenumber']).$search);
$return_viewname='';
if($_REQUEST['return_viewname'] != '') {
$return_viewname='&viewname='.vtlib_purify($_REQUEST['return_viewname']);
}
$page = '';
if(!empty($_REQUEST['pagenumber'])){
$page = '&start='.vtlib_purify($_REQUEST['pagenumber']);
}
header("Location: index.php?action=$return_action&module=$return_module&parenttab=$parenttab&".
"record=$return_id$return_viewname$page".$search);
?>
@@ -8,15 +8,16 @@
* All Rights Reserved.
*
********************************************************************************/
include_once 'modules/SalesOrder/SalesOrderPDFController.php';
include('include/InventoryPDF.php');
$pdf=get_so_pdf();
$controller = new Vtiger_SalesOrderPDFController($currentModule);
$controller->loadRecord(vtlib_purify($_REQUEST['record']));
$filenameid = $_REQUEST['record'];
if(empty($filenameid)) $filenameid = time();
$outputfilename = "storage/SalesOrder_$filenameid.pdf";
$pdf->Output($outputfilename,'F'); //added file name to make it work in IE, also forces the download giving the user the option to save
$filepath="storage/SalesOrder_$filenameid.pdf";
//added file name to make it work in IE, also forces the download giving the user the option to save
$controller->Output($filepath,'F');
// Added to fix annoying bug that includes HTML in your PDF
echo "<script>window.history.back();</script>";
@@ -185,6 +185,11 @@ $mod_strings = Array(
'Cancelled'=>'Cancelled',
'Adjustment'=>'Adjustment',
'Sub Total'=>'Sub Total',
'AutoCreated'=>'AutoCreated',
'Sent'=>'Sent',
'Credit Invoice'=>'Credit Invoice',
'Paid'=>'Paid',
//Added for Reports (5.0.4)
'Tax Type'=>'Tax Type',
@@ -1,35 +1,35 @@
<?php
/*********************************************************************************
** The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
*
********************************************************************************/
define('USD',"$");
define('EURO', chr(128) );
$desc=explode("\n",$description);
$cond=explode("\n",$conditions);
$num=230;
/* **************** Begin Description ****************** */
$descBlock=array("10",$top,"53", $num);
$pdf->addDescBlock($description, $app_strings["Description"], $descBlock);
/* ************** End Description *********************** */
/* **************** Begin Terms ****************** */
$termBlock=array("107",$top,"53", $num);
$pdf->addDescBlock($conditions, $app_strings["Terms & Conditions"], $termBlock);
/* ************** End Terms *********************** */
?>
<?php
/*********************************************************************************
** The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
*
********************************************************************************/
define('USD',"$");
define('EURO', chr(128) );
$desc=explode("\n",$description);
$cond=explode("\n",$conditions);
$num=230;
/* **************** Begin Description ****************** */
$descBlock=array("10",$top,"53", $num);
$pdf->addDescBlock($description, $app_strings["Description"], $descBlock);
/* ************** End Description *********************** */
/* **************** Begin Terms ****************** */
$termBlock=array("107",$top,"53", $num);
$pdf->addDescBlock($conditions, $app_strings["Terms & Conditions"], $termBlock);
/* ************** End Terms *********************** */
?>
@@ -78,8 +78,7 @@ $pdf->addTextBlock($app_strings["Billing Address"].':',$billText, $billPositions
// issue date block
$issueBlock=array("80","37");
//$pdf->addRecBlock(getDisplayDate(date("Y-m-d")), $app_strings["Issue Date"],$issueBlock);
$pdf->addRecBlock($create_time, $app_strings["Create Date"],$issueBlock);
$pdf->addRecBlock(getDisplayDate(date("Y-m-d")), $app_strings["Issue Date"],$issueBlock);
// due date block
$dueBlock=array("81","52");
@@ -1,62 +1,62 @@
<?php
/*********************************************************************************
** The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
*
********************************************************************************/
// Fun with watermarks :)
$waterMarkPositions=array("60","110");
$waterMarkRotate=array("0","0","0");
$pdf->watermark( $app_strings["Thank You"], $waterMarkPositions, $waterMarkRotate );
$waterMarkPositions=array("30","130");
$pdf->watermark( $app_strings["For Your Business"], $waterMarkPositions, $waterMarkRotate );
// blowing bubbles
$Bubble=array("10","80","170","4");
$pdf->addBubble("", "", $Bubble);
$Bubble=array("168","131","12");
//$pdf->addBubbleBlock("Neat Look", "For A", $Bubble);
$Bubble=array("10","131","12");
//$pdf->addBubbleBlock("The Corners", "Line Up", $Bubble);
/* ************* Begin Totals ************************** */
$totalBlock=array("59","135");
$names=array($app_strings["Subtotal"],$app_strings["Tax"],$app_strings["Adjustment"],$app_strings["Total"]);
$totals=array($price_subtotal,$price_salestax,$price_adjustment,$price_total);
$pdf->addTotalsRec($names,$totals,$totalBlock);
/* ************* End Totals *************************** */
// lets add an image :)
$imageBlock=array("15","95","8","8");
$pdf->addImage( "sale.jpeg", $imageBlock);
$imageBlock=array("185","95","8","8");
$pdf->addImage( "sale.jpeg", $imageBlock);
// descriptions that change sizes!
$descc=count(explode("\n",$description));
$condc=count(explode("\n",$conditions));
if( (strlen($description) > 256) || (strlen($conditions) > 256) || $condc >6 || $descc > 6 )
$num=255;
else
$num=150;
/* **************** Begin Description ****************** */
$descBlock=array("10","160","53", $num);
$pdf->addDescBlock($description, $app_strings["Description"], $descBlock);
$termBlock=array("107","160","53", $num);
$pdf->addDescBlock($conditions, $app_strings["Terms & Conditions"], $termBlock);
/* ************** End Terms *********************** */
?>
<?php
/*********************************************************************************
** The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
*
********************************************************************************/
// Fun with watermarks :)
$waterMarkPositions=array("60","110");
$waterMarkRotate=array("0","0","0");
$pdf->watermark( $app_strings["Thank You"], $waterMarkPositions, $waterMarkRotate );
$waterMarkPositions=array("30","130");
$pdf->watermark( $app_strings["For Your Business"], $waterMarkPositions, $waterMarkRotate );
// blowing bubbles
$Bubble=array("10","80","170","4");
$pdf->addBubble("", "", $Bubble);
$Bubble=array("168","131","12");
//$pdf->addBubbleBlock("Neat Look", "For A", $Bubble);
$Bubble=array("10","131","12");
//$pdf->addBubbleBlock("The Corners", "Line Up", $Bubble);
/* ************* Begin Totals ************************** */
$totalBlock=array("59","135");
$names=array($app_strings["Subtotal"],$app_strings["Tax"],$app_strings["Adjustment"],$app_strings["Total"]);
$totals=array($price_subtotal,$price_salestax,$price_adjustment,$price_total);
$pdf->addTotalsRec($names,$totals,$totalBlock);
/* ************* End Totals *************************** */
// lets add an image :)
$imageBlock=array("15","95","8","8");
$pdf->addImage( "sale.jpeg", $imageBlock);
$imageBlock=array("185","95","8","8");
$pdf->addImage( "sale.jpeg", $imageBlock);
// descriptions that change sizes!
$descc=count(explode("\n",$description));
$condc=count(explode("\n",$conditions));
if( (strlen($description) > 256) || (strlen($conditions) > 256) || $condc >6 || $descc > 6 )
$num=255;
else
$num=150;
/* **************** Begin Description ****************** */
$descBlock=array("10","160","53", $num);
$pdf->addDescBlock($description, $app_strings["Description"], $descBlock);
$termBlock=array("107","160","53", $num);
$pdf->addDescBlock($conditions, $app_strings["Terms & Conditions"], $termBlock);
/* ************** End Terms *********************** */
?>
@@ -1,60 +1,60 @@
<?php
/*********************************************************************************
** The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
*
********************************************************************************/
// draw a broken line
$width=3;
$area=216;
$pad=2;
for ($i=10;$i<200;$i++) {
$linePos=array($i,$area,$width);
$pdf->drawLine($linePos);
$i = (($i+$width)+$pad)-1;
}
// company addy
if($org_phone != '')
$phone="\n".$app_strings["Phone"].": ".$org_phone;
if($org_fax != '')
$fax ="\n".$app_strings["Fax"].": ".$org_fax;
$companyBlockPositions=array( "10","220","60" );
$companyText=$org_address."\n".$org_city.", ".$org_state." ".$org_code." ".$org_country." ".$phone." ".$fax."\n".$org_website ;
$pdf->addTextBlock( $org_name, $companyText ,$companyBlockPositions );
// billing Address
$billPositions = array("85","235","60");
if(trim($bill_street)!='')
$billText = $bill_street."\n";
if(trim($bill_city) !='')
$billText .= $bill_city.", ";
if(trim($bill_state)!='' || trim($bill_code)!= '')
$billText .= $bill_state." ".$bill_code."\n";
$billText .=$bill_country;
$pdf->addTextBlock($app_strings["Billing Address"].":",$billText, $billPositions);
// totals
$totalBlock=array("145","235","10", "110");
$totalText=$app_strings["Subtotal"].": ".$price_subtotal."\n".
$app_strings["Tax"].": ".$price_salestax."\n".
$app_strings["Adjustment"].": ".$price_adjustment."\n".
$app_strings["Total"].": ".$price_total;
$pdf->addDescBlock($totalText, $app_strings["Total Due"], $totalBlock);
$blurbBlock=array("10","265","150", "60");
$blockText=$app_strings["Detach_Info"];
$pdf->addDescBlock($blockText, $app_strings["Instructions"], $blurbBlock);
?>
<?php
/*********************************************************************************
** The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
*
********************************************************************************/
// draw a broken line
$width=3;
$area=216;
$pad=2;
for ($i=10;$i<200;$i++) {
$linePos=array($i,$area,$width);
$pdf->drawLine($linePos);
$i = (($i+$width)+$pad)-1;
}
// company addy
if($org_phone != '')
$phone="\n".$app_strings["Phone"].": ".$org_phone;
if($org_fax != '')
$fax ="\n".$app_strings["Fax"].": ".$org_fax;
$companyBlockPositions=array( "10","220","60" );
$companyText=$org_address."\n".$org_city.", ".$org_state." ".$org_code." ".$org_country." ".$phone." ".$fax."\n".$org_website ;
$pdf->addTextBlock( $org_name, $companyText ,$companyBlockPositions );
// billing Address
$billPositions = array("85","235","60");
if(trim($bill_street)!='')
$billText = $bill_street."\n";
if(trim($bill_city) !='')
$billText .= $bill_city.", ";
if(trim($bill_state)!='' || trim($bill_code)!= '')
$billText .= $bill_state." ".$bill_code."\n";
$billText .=$bill_country;
$pdf->addTextBlock($app_strings["Billing Address"].":",$billText, $billPositions);
// totals
$totalBlock=array("145","235","10", "110");
$totalText=$app_strings["Subtotal"].": ".$price_subtotal."\n".
$app_strings["Tax"].": ".$price_salestax."\n".
$app_strings["Adjustment"].": ".$price_adjustment."\n".
$app_strings["Total"].": ".$price_total;
$pdf->addDescBlock($totalText, $app_strings["Total Due"], $totalBlock);
$blurbBlock=array("10","265","150", "60");
$blockText=$app_strings["Detach_Info"];
$pdf->addDescBlock($blockText, $app_strings["Instructions"], $blurbBlock);
?>