From fd6c951deb45642ddce135f3b337964faa002413 Mon Sep 17 00:00:00 2001 From: YuCheng Hu Date: Tue, 16 Nov 2010 07:59:52 +0000 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=88=B0=205.2=20=E6=AD=A3?= =?UTF-8?q?=E5=BC=8F=E7=89=88=E5=90=8E=E7=AC=AC=E4=B8=80=E6=AC=A1=20SVN=20?= =?UTF-8?q?=E6=8F=90=E4=BA=A4=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit yuchenghu@hawebs.net git-svn-id: https://svn.code.sf.net/p/hawebs/svn@614 a2543c7e-f6e9-4f8a-8bff-1ffc34733512 --- .../trunk/modules/Invoice/CallRelatedList.php | 85 +++ .../trunk/modules/Invoice/CreatePDF.php | 26 + .../trunk/modules/Invoice/CustomView.php | 14 + oss/vtiger/trunk/modules/Invoice/Delete.php | 38 ++ .../trunk/modules/Invoice/DetailView.php | 138 +++++ .../trunk/modules/Invoice/DetailViewAjax.php | 48 ++ oss/vtiger/trunk/modules/Invoice/EditView.php | 387 +++++++++++++ oss/vtiger/trunk/modules/Invoice/Invoice.js | 55 ++ oss/vtiger/trunk/modules/Invoice/Invoice.php | 513 ++++++++++++++++++ .../trunk/modules/Invoice/InvoiceAjax.php | 12 + .../modules/Invoice/InvoicePDFController.php | 59 ++ .../trunk/modules/Invoice/ListTopInvoice.php | 164 ++++++ oss/vtiger/trunk/modules/Invoice/ListView.php | 236 ++++++++ .../trunk/modules/Invoice/ListViewPagging.php | 11 + oss/vtiger/trunk/modules/Invoice/MassEdit.php | 45 ++ .../trunk/modules/Invoice/MassEditSave.php | 67 +++ oss/vtiger/trunk/modules/Invoice/Popup.php | 13 + oss/vtiger/trunk/modules/Invoice/Save.php | 65 +++ .../trunk/modules/Invoice/SendPDFMail.php | 25 + oss/vtiger/trunk/modules/Invoice/Settings.php | 13 + oss/vtiger/trunk/modules/Invoice/TagCloud.php | 12 + .../trunk/modules/Invoice/UnifiedSearch.php | 11 + oss/vtiger/trunk/modules/Invoice/index.php | 52 ++ .../modules/Invoice/language/en_us.lang.php | 202 +++++++ .../modules/Invoice/language/zh_cn.lang.php | 201 +++++++ .../modules/Invoice/pdf_templates/footer.php | 35 ++ .../modules/Invoice/pdf_templates/header.php | 104 ++++ .../Invoice/pdf_templates/lastpage/body.php | 62 +++ .../Invoice/pdf_templates/lastpage/footer.php | 59 ++ .../trunk/modules/Invoice/updateRelations.php | 48 ++ 30 files changed, 2800 insertions(+) create mode 100644 oss/vtiger/trunk/modules/Invoice/CallRelatedList.php create mode 100644 oss/vtiger/trunk/modules/Invoice/CreatePDF.php create mode 100644 oss/vtiger/trunk/modules/Invoice/CustomView.php create mode 100644 oss/vtiger/trunk/modules/Invoice/Delete.php create mode 100644 oss/vtiger/trunk/modules/Invoice/DetailView.php create mode 100644 oss/vtiger/trunk/modules/Invoice/DetailViewAjax.php create mode 100644 oss/vtiger/trunk/modules/Invoice/EditView.php create mode 100644 oss/vtiger/trunk/modules/Invoice/Invoice.js create mode 100644 oss/vtiger/trunk/modules/Invoice/Invoice.php create mode 100644 oss/vtiger/trunk/modules/Invoice/InvoiceAjax.php create mode 100644 oss/vtiger/trunk/modules/Invoice/InvoicePDFController.php create mode 100644 oss/vtiger/trunk/modules/Invoice/ListTopInvoice.php create mode 100644 oss/vtiger/trunk/modules/Invoice/ListView.php create mode 100644 oss/vtiger/trunk/modules/Invoice/ListViewPagging.php create mode 100644 oss/vtiger/trunk/modules/Invoice/MassEdit.php create mode 100644 oss/vtiger/trunk/modules/Invoice/MassEditSave.php create mode 100644 oss/vtiger/trunk/modules/Invoice/Popup.php create mode 100644 oss/vtiger/trunk/modules/Invoice/Save.php create mode 100644 oss/vtiger/trunk/modules/Invoice/SendPDFMail.php create mode 100644 oss/vtiger/trunk/modules/Invoice/Settings.php create mode 100644 oss/vtiger/trunk/modules/Invoice/TagCloud.php create mode 100644 oss/vtiger/trunk/modules/Invoice/UnifiedSearch.php create mode 100644 oss/vtiger/trunk/modules/Invoice/index.php create mode 100644 oss/vtiger/trunk/modules/Invoice/language/en_us.lang.php create mode 100644 oss/vtiger/trunk/modules/Invoice/language/zh_cn.lang.php create mode 100644 oss/vtiger/trunk/modules/Invoice/pdf_templates/footer.php create mode 100644 oss/vtiger/trunk/modules/Invoice/pdf_templates/header.php create mode 100644 oss/vtiger/trunk/modules/Invoice/pdf_templates/lastpage/body.php create mode 100644 oss/vtiger/trunk/modules/Invoice/pdf_templates/lastpage/footer.php create mode 100644 oss/vtiger/trunk/modules/Invoice/updateRelations.php diff --git a/oss/vtiger/trunk/modules/Invoice/CallRelatedList.php b/oss/vtiger/trunk/modules/Invoice/CallRelatedList.php new file mode 100644 index 00000000..b6959942 --- /dev/null +++ b/oss/vtiger/trunk/modules/Invoice/CallRelatedList.php @@ -0,0 +1,85 @@ +retrieve_entity_info($RECORD,$currentmodule); + $focus->id = $RECORD; + $focus->name=$focus->column_fields['subject']; + $log->debug("id is ".$focus->id); + $log->debug("name is ".$focus->name); + } + + global $mod_strings; + global $app_strings; + global $currentModule; + global $theme; + $theme_path="themes/".$theme."/"; + $image_path=$theme_path."images/"; + + $smarty = new vtigerCRM_Smarty; + + 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("CATEGORY",$category); + if(isset($_REQUEST['mode']) && $_REQUEST['mode'] != ' ') { + $smarty->assign("OP_MODE",vtlib_purify($_REQUEST['mode'])); + } + $smarty->assign("TODO_PERMISSION",CheckFieldPermission('parent_id','Calendar')); + $smarty->assign("EVENT_PERMISSION",CheckFieldPermission('parent_id','Events')); + $smarty->assign("ID",$focus->id); + + // Module Sequence Numbering + $mod_seq_field = getModuleSequenceField($currentModule); + if ($mod_seq_field != null) { + $mod_seq_id = $focus->column_fields[$mod_seq_field['name']]; + } else { + $mod_seq_id = $focus->id; + } + $smarty->assign('MOD_SEQ_ID', $mod_seq_id); + // END + + $smarty->assign("MODULE",$currentmodule); + $smarty->assign("SINGLE_MOD",$mod_strings['Invoice']); + $smarty->assign("UPDATEINFO",updateInfo($focus->id)); + $smarty->assign("MOD",$mod_strings); + $smarty->assign("APP",$app_strings); + $smarty->assign("THEME", $theme); + $smarty->assign("IMAGE_PATH", $image_path); + + $check_button = Button_Check($module); + $smarty->assign("CHECK", $check_button); + $smarty->display("RelatedLists.tpl"); +} +?> \ No newline at end of file diff --git a/oss/vtiger/trunk/modules/Invoice/CreatePDF.php b/oss/vtiger/trunk/modules/Invoice/CreatePDF.php new file mode 100644 index 00000000..bb64e032 --- /dev/null +++ b/oss/vtiger/trunk/modules/Invoice/CreatePDF.php @@ -0,0 +1,26 @@ +loadRecord(vtlib_purify($_REQUEST['record'])); + +if(isset($_REQUEST['savemode']) && $_REQUEST['savemode'] == 'file') { + $id = vtlib_purify($_REQUEST['record']); + $filepath='test/product/'.$id.'_Invoice.pdf'; + $controller->Output($filepath,'F'); //added file name to make it work in IE, also forces the download giving the user the option to save +} else { + $controller->Output('Invoice.pdf', 'D');//added file name to make it work in IE, also forces the download giving the user the option to save + exit(); +} + +?> diff --git a/oss/vtiger/trunk/modules/Invoice/CustomView.php b/oss/vtiger/trunk/modules/Invoice/CustomView.php new file mode 100644 index 00000000..93231ed6 --- /dev/null +++ b/oss/vtiger/trunk/modules/Invoice/CustomView.php @@ -0,0 +1,14 @@ + diff --git a/oss/vtiger/trunk/modules/Invoice/Delete.php b/oss/vtiger/trunk/modules/Invoice/Delete.php new file mode 100644 index 00000000..fdc8a921 --- /dev/null +++ b/oss/vtiger/trunk/modules/Invoice/Delete.php @@ -0,0 +1,38 @@ + \ No newline at end of file diff --git a/oss/vtiger/trunk/modules/Invoice/DetailView.php b/oss/vtiger/trunk/modules/Invoice/DetailView.php new file mode 100644 index 00000000..324e9aa2 --- /dev/null +++ b/oss/vtiger/trunk/modules/Invoice/DetailView.php @@ -0,0 +1,138 @@ +retrieve_entity_info($_REQUEST['record'],"Invoice"); + $focus->id = $_REQUEST['record']; + $focus->name=$focus->column_fields['subject']; +} + +if(isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true') { + $focus->id = ""; +} + +$theme_path="themes/".$theme."/"; +$image_path=$theme_path."images/"; + +$log->info("Order detail view"); + + +$smarty = new vtigerCRM_Smarty; +$smarty->assign("MOD", $mod_strings); +$smarty->assign("APP", $app_strings); +$smarty->assign("MODULE",$currentModule); + +$smarty->assign("UPDATEINFO",updateInfo($focus->id)); + +$smarty->assign("THEME", $theme); +$smarty->assign("IMAGE_PATH", $image_path); +$smarty->assign("PRINT_URL", "phprint.php?jt=".session_id().$GLOBALS['request_string']); + +if (isset($focus->name)) $smarty->assign("NAME", $focus->name); +else $smarty->assign("NAME", ""); +$smarty->assign("BLOCKS", getBlocks($currentModule,"detail_view",'',$focus->column_fields)); + +$smarty->assign("CUSTOMFIELD", $cust_fld); +$smarty->assign("ID", vtlib_purify($_REQUEST['record'])); + +// Module Sequence Numbering +$mod_seq_field = getModuleSequenceField($currentModule); +if ($mod_seq_field != null) { + $mod_seq_id = $focus->column_fields[$mod_seq_field['name']]; +} else { + $mod_seq_id = $focus->id; +} +$smarty->assign('MOD_SEQ_ID', $mod_seq_id); +// END + +$smarty->assign("SINGLE_MOD", 'Invoice'); +$category = getParentTab(); +$smarty->assign("CATEGORY",$category); + +if(isPermitted("Invoice","EditView",$_REQUEST['record']) == 'yes') + $smarty->assign("EDIT_DUPLICATE","permitted"); + +$smarty->assign("CREATEPDF","permitted"); + +if(isPermitted("Invoice","Delete",$_REQUEST['record']) == 'yes') + $smarty->assign("DELETE","permitted"); + +//Get the associated Products and then display above Terms and Conditions +$smarty->assign("ASSOCIATED_PRODUCTS",getDetailAssociatedProducts('Invoice',$focus)); + +$check_button = Button_Check($module); +$smarty->assign("CHECK", $check_button); + +$tabid = getTabid("Invoice"); +$validationData = getDBValidationData($focus->tab_name,$tabid); +$data = split_validationdataArray($validationData); +$smarty->assign("VALIDATION_DATA_FIELDNAME",$data['fieldname']); +$smarty->assign("VALIDATION_DATA_FIELDDATATYPE",$data['datatype']); +$smarty->assign("VALIDATION_DATA_FIELDLABEL",$data['fieldlabel']); +$smarty->assign("EDIT_PERMISSION",isPermitted($currentModule,'EditView',$_REQUEST['record'])); +$smarty->assign("TODO_PERMISSION",CheckFieldPermission('parent_id','Calendar')); +$smarty->assign("EVENT_PERMISSION",CheckFieldPermission('parent_id','Events')); + +$smarty->assign("IS_REL_LIST",isPresentRelatedLists($currentModule)); +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); + +if(PerformancePrefs::getBoolean('DETAILVIEW_RECORD_NAVIGATION', true) && isset($_SESSION[$currentModule.'_listquery'])){ + $recordNavigationInfo = ListViewSession::getListViewNavigation($focus->id); + VT_detailViewNavigation($smarty,$recordNavigationInfo,$focus->id); +} + +// Record Change Notification +$focus->markAsViewed($current_user->id); +// END + +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)); + +$smarty->assign('DETAILVIEW_AJAX_EDIT', PerformancePrefs::getBoolean('DETAILVIEW_AJAX_EDIT', true)); + +$smarty->display("Inventory/InventoryDetailView.tpl"); + +?> \ No newline at end of file diff --git a/oss/vtiger/trunk/modules/Invoice/DetailViewAjax.php b/oss/vtiger/trunk/modules/Invoice/DetailViewAjax.php new file mode 100644 index 00000000..31a8d583 --- /dev/null +++ b/oss/vtiger/trunk/modules/Invoice/DetailViewAjax.php @@ -0,0 +1,48 @@ +retrieve_entity_info($crmid,"Invoice"); + $modObj->column_fields[$fieldname] = $fieldvalue; + $modObj->id = $crmid; + $modObj->mode = "edit"; + $modObj->save("Invoice"); + if($modObj->id != "") + { + echo ":#:SUCCESS"; + }else + { + echo ":#:FAILURE"; + } + }else + { + echo ":#:FAILURE"; + } +} elseif($ajaxaction == "LOADRELATEDLIST" || $ajaxaction == "DISABLEMODULE"){ + require_once 'include/ListView/RelatedListViewContents.php'; +} +?> \ No newline at end of file diff --git a/oss/vtiger/trunk/modules/Invoice/EditView.php b/oss/vtiger/trunk/modules/Invoice/EditView.php new file mode 100644 index 00000000..6a7195ac --- /dev/null +++ b/oss/vtiger/trunk/modules/Invoice/EditView.php @@ -0,0 +1,387 @@ +assign("SEARCH", $searchurl); +//4600 ends + +$currencyid = fetchCurrency($current_user->id); +$rate_symbol = getCurrencySymbolandCRate($currencyid); +$rate = $rate_symbol['rate']; +if (isset ($_REQUEST['record']) && $_REQUEST['record'] != '') { + if (isset ($_REQUEST['convertmode']) && $_REQUEST['convertmode'] == 'quotetoinvoice') { + $quoteid = $_REQUEST['record']; + $quote_focus = new Quotes(); + $quote_focus->id = $quoteid; + $quote_focus->retrieve_entity_info($quoteid, "Quotes"); + $focus = getConvertQuoteToInvoice($focus, $quote_focus, $quoteid); + + // Reset the value w.r.t Quote Selected + $currencyid = $quote_focus->column_fields['currency_id']; + $rate = $quote_focus->column_fields['conversion_rate']; + + //Added to display the Quote's associated vtiger_products -- when we create vtiger_invoice from Quotes DetailView + $associated_prod = getAssociatedProducts("Quotes", $quote_focus); + $txtTax = (($quote_focus->column_fields['txtTax'] != '') ? $quote_focus->column_fields['txtTax'] : '0.000'); + $txtAdj = (($quote_focus->column_fields['txtAdjustment'] != '') ? $quote_focus->column_fields['txtAdjustment'] : '0.000'); + + $smarty->assign("CONVERT_MODE", vtlib_purify($_REQUEST['convertmode'])); + $smarty->assign("ASSOCIATEDPRODUCTS", $associated_prod); + $smarty->assign("MODE", $quote_focus->mode); + $smarty->assign("AVAILABLE_PRODUCTS", 'true'); + } + elseif (isset ($_REQUEST['convertmode']) && $_REQUEST['convertmode'] == 'sotoinvoice') { + $soid = $_REQUEST['record']; + $so_focus = new SalesOrder(); + $so_focus->id = $soid; + $so_focus->retrieve_entity_info($soid, "SalesOrder"); + $focus = getConvertSoToInvoice($focus, $so_focus, $soid); + + // Reset the value w.r.t SalesOrder Selected + $currencyid = $so_focus->column_fields['currency_id']; + $rate = $so_focus->column_fields['conversion_rate']; + + //added to set the PO number and terms and conditions + $focus->column_fields['vtiger_purchaseorder'] = $so_focus->column_fields['vtiger_purchaseorder']; + $focus->column_fields['terms_conditions'] = $so_focus->column_fields['terms_conditions']; + + //Added to display the SalesOrder's associated vtiger_products -- when we create vtiger_invoice from SO DetailView + $associated_prod = getAssociatedProducts("SalesOrder", $so_focus); + $txtTax = (($so_focus->column_fields['txtTax'] != '') ? $so_focus->column_fields['txtTax'] : '0.000'); + $txtAdj = (($so_focus->column_fields['txtAdjustment'] != '') ? $so_focus->column_fields['txtAdjustment'] : '0.000'); + + $smarty->assign("CONVERT_MODE", vtlib_purify($_REQUEST['convertmode'])); + $smarty->assign("ASSOCIATEDPRODUCTS", $associated_prod); + $smarty->assign("MODE", $so_focus->mode); + $smarty->assign("AVAILABLE_PRODUCTS", 'true'); + + } + elseif (isset ($_REQUEST['convertmode']) && $_REQUEST['convertmode'] == 'potentoinvoice') { + $focus->mode = ''; + } + elseif (isset ($_REQUEST['convertmode']) && $_REQUEST['convertmode'] == 'update_so_val') { + //Updating the Selected SO Value in Edit Mode + foreach ($focus->column_fields as $fieldname => $val) { + if (isset ($_REQUEST[$fieldname])) { + $value = $_REQUEST[$fieldname]; + $focus->column_fields[$fieldname] = $value; + } + + } + //Handling for dateformat in vtiger_invoicedate vtiger_field + if ($focus->column_fields['invoicedate'] != '') { + $curr_due_date = $focus->column_fields['invoicedate']; + $focus->column_fields['invoicedate'] = getDBInsertDateValue($curr_due_date); + } + + $soid = $focus->column_fields['salesorder_id']; + $so_focus = new SalesOrder(); + $so_focus->id = $soid; + $so_focus->retrieve_entity_info($soid, "SalesOrder"); + $focus = getConvertSoToInvoice($focus, $so_focus, $soid); + $focus->id = $_REQUEST['record']; + $focus->mode = 'edit'; + $focus->name = $focus->column_fields['subject']; + + // Reset the value w.r.t SalesOrder Selected + $currencyid = $so_focus->column_fields['currency_id']; + $rate = $so_focus->column_fields['conversion_rate']; + } else { + $focus->id = $_REQUEST['record']; + $focus->mode = 'edit'; + $focus->retrieve_entity_info($_REQUEST['record'], "Invoice"); + $focus->name = $focus->column_fields['subject']; + } +} else { + if (isset ($_REQUEST['convertmode']) && $_REQUEST['convertmode'] == 'update_so_val') { + //Updating the Selected SO Value in Create Mode + foreach ($focus->column_fields as $fieldname => $val) { + if (isset ($_REQUEST[$fieldname])) { + $value = $_REQUEST[$fieldname]; + $focus->column_fields[$fieldname] = $value; + } + + } + //Handling for dateformat in vtiger_invoicedate vtiger_field + if ($focus->column_fields['invoicedate'] != '') { + $curr_due_date = $focus->column_fields['invoicedate']; + $focus->column_fields['invoicedate'] = getDBInsertDateValue($curr_due_date); + } + + $soid = $focus->column_fields['salesorder_id']; + $so_focus = new SalesOrder(); + $so_focus->id = $soid; + $so_focus->retrieve_entity_info($soid, "SalesOrder"); + $focus = getConvertSoToInvoice($focus, $so_focus, $soid); + + // Reset the value w.r.t SalesOrder Selected + $currencyid = $so_focus->column_fields['currency_id']; + $rate = $so_focus->column_fields['conversion_rate']; + + //Added to display the SO's associated products -- when we select SO in New Invoice page + if (isset ($_REQUEST['salesorder_id']) && $_REQUEST['salesorder_id'] != '') { + $associated_prod = getAssociatedProducts("SalesOrder", $so_focus, $focus->column_fields['salesorder_id']); + } + + $smarty->assign("SALESORDER_ID", $focus->column_fields['salesorder_id']); + $smarty->assign("ASSOCIATEDPRODUCTS", $associated_prod); + $smarty->assign("MODE", $so_focus->mode); + $smarty->assign("AVAILABLE_PRODUCTS", 'true'); + + } +} +if (isset ($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true') { + $smarty->assign("DUPLICATE_FROM", $focus->id); + $INVOICE_associated_prod = getAssociatedProducts("Invoice", $focus); + $focus->id = ""; + $focus->mode = ''; +} +if(empty($_REQUEST['record']) && $focus->mode != 'edit'){ + setObjectValuesFromRequest($focus); +} +if (isset ($_REQUEST['opportunity_id']) && $_REQUEST['opportunity_id'] != '') { + $potfocus = new Potentials(); + $potfocus->column_fields['potential_id'] = $_REQUEST['opportunity_id']; + $associated_prod = getAssociatedProducts("Potentials", $potfocus, $potfocus->column_fields['potential_id']); + +} +if (isset ($_REQUEST['product_id']) && $_REQUEST['product_id'] != '') { + $focus->column_fields['product_id'] = $_REQUEST['product_id']; + $log->debug("Invoice EditView: Product Id from the request is " . $_REQUEST['product_id']); + $associated_prod = getAssociatedProducts("Products", $focus, $focus->column_fields['product_id']); + for ($i=1; $i<=count($associated_prod);$i++) { + $associated_prod_id = $associated_prod[$i]['hdnProductId'.$i]; + $associated_prod_prices = getPricesForProducts($currencyid,array($associated_prod_id),'Products'); + $associated_prod[$i]['listPrice'.$i] = $associated_prod_prices[$associated_prod_id]; + } + $smarty->assign("ASSOCIATEDPRODUCTS", $associated_prod); + $smarty->assign("AVAILABLE_PRODUCTS", 'true'); +} +if (!empty ($_REQUEST['parent_id']) && !empty ($_REQUEST['return_module'])) { + if ($_REQUEST['return_module'] == 'Services') { + $focus->column_fields['product_id'] = $_REQUEST['parent_id']; + $log->debug("Service Id from the request is " . $_REQUEST['parent_id']); + $associated_prod = getAssociatedProducts("Services", $focus, $focus->column_fields['product_id']); + for ($i=1; $i<=count($associated_prod);$i++) { + $associated_prod_id = $associated_prod[$i]['hdnProductId'.$i]; + $associated_prod_prices = getPricesForProducts($currencyid,array($associated_prod_id),'Services'); + $associated_prod[$i]['listPrice'.$i] = $associated_prod_prices[$associated_prod_id]; + } + $smarty->assign("ASSOCIATEDPRODUCTS", $associated_prod); + $smarty->assign("AVAILABLE_PRODUCTS", 'true'); + } +} + +if (isset ($_REQUEST['account_id']) && $_REQUEST['account_id'] != '' && ($_REQUEST['record'] == '' || $_REQUEST['convertmode'] == "potentoinvoice") && ($_REQUEST['convertmode'] != 'update_so_val')) { + require_once ('modules/Accounts/Accounts.php'); + $acct_focus = new Accounts(); + $acct_focus->retrieve_entity_info($_REQUEST['account_id'], "Accounts"); + $focus->column_fields['bill_city'] = $acct_focus->column_fields['bill_city']; + $focus->column_fields['ship_city'] = $acct_focus->column_fields['ship_city']; + $focus->column_fields['bill_street'] = $acct_focus->column_fields['bill_street']; + $focus->column_fields['ship_street'] = $acct_focus->column_fields['ship_street']; + $focus->column_fields['bill_state'] = $acct_focus->column_fields['bill_state']; + $focus->column_fields['ship_state'] = $acct_focus->column_fields['ship_state']; + $focus->column_fields['bill_code'] = $acct_focus->column_fields['bill_code']; + $focus->column_fields['ship_code'] = $acct_focus->column_fields['ship_code']; + $focus->column_fields['bill_country'] = $acct_focus->column_fields['bill_country']; + $focus->column_fields['ship_country'] = $acct_focus->column_fields['ship_country']; + $focus->column_fields['bill_pobox'] = $acct_focus->column_fields['bill_pobox']; + $focus->column_fields['ship_pobox'] = $acct_focus->column_fields['ship_pobox']; + +} + +global $theme; +$theme_path = "themes/" . $theme . "/"; +$image_path = $theme_path . "images/"; + +$disp_view = getView($focus->mode); +$mode = $focus->mode; +if ($disp_view == 'edit_view') + $smarty->assign("BLOCKS", getBlocks($currentModule, $disp_view, $mode, $focus->column_fields)); +else { + $bas_block = getBlocks($currentModule, $disp_view, $mode, $focus->column_fields, 'BAS'); + $adv_block = getBlocks($currentModule, $disp_view, $mode, $focus->column_fields, 'ADV'); + + $blocks['basicTab'] = $bas_block; + if (is_array($adv_block)) + $blocks['moreTab'] = $adv_block; + + $smarty->assign("BLOCKS", $blocks); + $smarty->assign("BLOCKS_COUNT", count($blocks)); +} + +$smarty->assign("OP_MODE", $disp_view); + +$smarty->assign("MODULE", $currentModule); +$smarty->assign("SINGLE_MOD", 'Invoice'); + +$smarty->assign("MOD", $mod_strings); +$smarty->assign("APP", $app_strings); + +$log->info("Invoice view"); + +if (isset ($focus->name)) + $smarty->assign("NAME", $focus->name); +else + $smarty->assign("NAME", ""); + +if (isset ($_REQUEST['convertmode']) && $_REQUEST['convertmode'] == 'quotetoinvoice') { + $smarty->assign("MODE", $quote_focus->mode); + $se_array = getProductDetailsBlockInfo($quote_focus->mode, "Quotes", $quote_focus); +} +elseif (isset ($_REQUEST['convertmode']) && ($_REQUEST['convertmode'] == 'sotoinvoice' || $_REQUEST['convertmode'] == 'update_so_val')) { + $smarty->assign("MODE", $focus->mode); + $se_array = getProductDetailsBlockInfo($focus->mode, "SalesOrder", $so_focus); + + $txtTax = (($so_focus->column_fields['txtTax'] != '') ? $so_focus->column_fields['txtTax'] : '0.000'); + $txtAdj = (($so_focus->column_fields['txtAdjustment'] != '') ? $so_focus->column_fields['txtAdjustment'] : '0.000'); + + $associated_prod = getAssociatedProducts("SalesOrder", $so_focus); + $smarty->assign("ASSOCIATEDPRODUCTS", $associated_prod); + $smarty->assign("MODE", $focus->mode); +} +elseif ($focus->mode == 'edit') { + $smarty->assign("UPDATEINFO", updateInfo($focus->id)); + $associated_prod = getAssociatedProducts("Invoice", $focus); + $smarty->assign("ASSOCIATEDPRODUCTS", $associated_prod); + $smarty->assign("MODE", $focus->mode); +} +elseif (isset ($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true') { + $associated_prod = $INVOICE_associated_prod; + $smarty->assign("AVAILABLE_PRODUCTS", 'true'); + $smarty->assign("MODE", $focus->mode); +} +elseif ((isset ($_REQUEST['product_id']) && $_REQUEST['product_id'] != '') || (isset ($_REQUEST['opportunity_id']) && $_REQUEST['opportunity_id'] != '')) { + $smarty->assign("ASSOCIATEDPRODUCTS", $associated_prod); + $InvTotal = getInventoryTotal($_REQUEST['return_module'], $_REQUEST['return_id']); + $smarty->assign("MODE", $focus->mode); + + //this is to display the Product Details in first row when we create new PO from Product relatedlist + if ($_REQUEST['return_module'] == 'Products') { + $smarty->assign("PRODUCT_ID", vtlib_purify($_REQUEST['product_id'])); + $smarty->assign("PRODUCT_NAME", getProductName($_REQUEST['product_id'])); + $smarty->assign("UNIT_PRICE", vtlib_purify($_REQUEST['product_id'])); + $smarty->assign("QTY_IN_STOCK", getPrdQtyInStck($_REQUEST['product_id'])); + $smarty->assign("VAT_TAX", getProductTaxPercentage("VAT", $_REQUEST['product_id'])); + $smarty->assign("SALES_TAX", getProductTaxPercentage("Sales", $_REQUEST['product_id'])); + $smarty->assign("SERVICE_TAX", getProductTaxPercentage("Service", $_REQUEST['product_id'])); + } +} + +if (isset ($cust_fld)) { + $smarty->assign("CUSTOMFIELD", $cust_fld); +} + +$smarty->assign("ASSOCIATEDPRODUCTS", $associated_prod); + +if (isset ($_REQUEST['return_module'])) + $smarty->assign("RETURN_MODULE", vtlib_purify($_REQUEST['return_module'])); +else + $smarty->assign("RETURN_MODULE", "Invoice"); +if (isset ($_REQUEST['return_action'])) + $smarty->assign("RETURN_ACTION", vtlib_purify($_REQUEST['return_action'])); +else + $smarty->assign("RETURN_ACTION", "index"); +if (isset ($_REQUEST['return_id'])) + $smarty->assign("RETURN_ID", vtlib_purify($_REQUEST['return_id'])); +if (isset ($_REQUEST['return_viewname'])) + $smarty->assign("RETURN_VIEWNAME", vtlib_purify($_REQUEST['return_viewname'])); +$smarty->assign("THEME", $theme); +$smarty->assign("IMAGE_PATH", $image_path); +$smarty->assign("PRINT_URL", "phprint.php?jt=" . session_id() . $GLOBALS['request_string']); +$smarty->assign("ID", $focus->id); + +$smarty->assign("CALENDAR_LANG", $app_strings['LBL_JSCALENDAR_LANG']); +$smarty->assign("CALENDAR_DATEFORMAT", parse_calendardate($app_strings['NTC_DATE_FORMAT'])); + +//in create new Invoice, get all available product taxes and shipping & Handling taxes + +if ($focus->mode != 'edit') { + $tax_details = getAllTaxes('available'); + $sh_tax_details = getAllTaxes('available', 'sh'); +} else { + $tax_details = getAllTaxes('available', '', $focus->mode, $focus->id); + $sh_tax_details = getAllTaxes('available', 'sh', 'edit', $focus->id); +} +$smarty->assign("GROUP_TAXES", $tax_details); +$smarty->assign("SH_TAXES", $sh_tax_details); + +$tabid = getTabid("Invoice"); +$validationData = getDBValidationData($focus->tab_name, $tabid); +$data = split_validationdataArray($validationData); +$category = getParentTab(); +$smarty->assign("CATEGORY", $category); + +$smarty->assign("VALIDATION_DATA_FIELDNAME", $data['fieldname']); +$smarty->assign("VALIDATION_DATA_FIELDDATATYPE", $data['datatype']); +$smarty->assign("VALIDATION_DATA_FIELDLABEL", $data['fieldlabel']); + +global $adb; +// Module Sequence Numbering +$mod_seq_field = getModuleSequenceField($currentModule); +if ($focus->mode != 'edit' && $mod_seq_field != null) { + $autostr = getTranslatedString('MSG_AUTO_GEN_ON_SAVE'); + $mod_seq_string = $adb->pquery("SELECT prefix, cur_id from vtiger_modentity_num where semodule = ? and active=1", array ( + $currentModule + )); + $mod_seq_prefix = $adb->query_result($mod_seq_string, 0, 'prefix'); + $mod_seq_no = $adb->query_result($mod_seq_string, 0, 'cur_id'); + if ($adb->num_rows($mod_seq_string) == 0 || $focus->checkModuleSeqNumber($focus->table_name, $mod_seq_field['column'], $mod_seq_prefix . $mod_seq_no)) + echo '
' . getTranslatedString('LBL_DUPLICATE') . ' ' . getTranslatedString($mod_seq_field['label']) . + ' - ' . getTranslatedString('LBL_CLICK') . ' ' . getTranslatedString('LBL_HERE') . ' ' . getTranslatedString('LBL_TO_CONFIGURE') . ' ' . getTranslatedString($mod_seq_field['label']) . ''; + else + $smarty->assign("MOD_SEQ_ID", $autostr); +} else { + $smarty->assign("MOD_SEQ_ID", $focus->column_fields[$mod_seq_field['name']]); +} +// END + +$smarty->assign("CURRENCIES_LIST", getAllCurrencies()); +if ($focus->mode == 'edit' || $_REQUEST['isDuplicate'] == 'true') { + $inventory_cur_info = getInventoryCurrencyInfo('Invoice', $focus->id); + $smarty->assign("INV_CURRENCY_ID", $inventory_cur_info['currency_id']); +} else { + $smarty->assign("INV_CURRENCY_ID", $currencyid); +} + +$check_button = Button_Check($module); +$smarty->assign("CHECK", $check_button); +$smarty->assign("DUPLICATE",vtlib_purify($_REQUEST['isDuplicate'])); +if ($focus->mode == 'edit') + $smarty->display("Inventory/InventoryEditView.tpl"); +else + $smarty->display('Inventory/InventoryCreateView.tpl'); +?> \ No newline at end of file diff --git a/oss/vtiger/trunk/modules/Invoice/Invoice.js b/oss/vtiger/trunk/modules/Invoice/Invoice.js new file mode 100644 index 00000000..d1c18bda --- /dev/null +++ b/oss/vtiger/trunk/modules/Invoice/Invoice.js @@ -0,0 +1,55 @@ +/********************************************************************************* +** 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. + * + ********************************************************************************/ + +document.write(""; +exit() +?> diff --git a/oss/vtiger/trunk/modules/Invoice/Settings.php b/oss/vtiger/trunk/modules/Invoice/Settings.php new file mode 100644 index 00000000..980dd078 --- /dev/null +++ b/oss/vtiger/trunk/modules/Invoice/Settings.php @@ -0,0 +1,13 @@ + diff --git a/oss/vtiger/trunk/modules/Invoice/TagCloud.php b/oss/vtiger/trunk/modules/Invoice/TagCloud.php new file mode 100644 index 00000000..859b11ff --- /dev/null +++ b/oss/vtiger/trunk/modules/Invoice/TagCloud.php @@ -0,0 +1,12 @@ + diff --git a/oss/vtiger/trunk/modules/Invoice/UnifiedSearch.php b/oss/vtiger/trunk/modules/Invoice/UnifiedSearch.php new file mode 100644 index 00000000..9a37320c --- /dev/null +++ b/oss/vtiger/trunk/modules/Invoice/UnifiedSearch.php @@ -0,0 +1,11 @@ + \ No newline at end of file diff --git a/oss/vtiger/trunk/modules/Invoice/index.php b/oss/vtiger/trunk/modules/Invoice/index.php new file mode 100644 index 00000000..986c4aa8 --- /dev/null +++ b/oss/vtiger/trunk/modules/Invoice/index.php @@ -0,0 +1,52 @@ + diff --git a/oss/vtiger/trunk/modules/Invoice/language/en_us.lang.php b/oss/vtiger/trunk/modules/Invoice/language/en_us.lang.php new file mode 100644 index 00000000..5d9599bf --- /dev/null +++ b/oss/vtiger/trunk/modules/Invoice/language/en_us.lang.php @@ -0,0 +1,202 @@ +'Invoice', +'LBL_SO_MODULE_NAME'=>'Invoice', +'LBL_RELATED_PRODUCTS'=>'Product Details', +'LBL_MODULE_TITLE'=>'Invoice: Home', +'LBL_SEARCH_FORM_TITLE'=>'Invoice Search', +'LBL_LIST_FORM_TITLE'=>'Invoice List', +'LBL_LIST_SO_FORM_TITLE'=>'Sales Order List', +'LBL_NEW_FORM_TITLE'=>'New Invoice', +'LBL_NEW_FORM_SO_TITLE'=>'New Sales Order', +'LBL_MEMBER_ORG_FORM_TITLE'=>'Member Organizations', + +'LBL_LIST_ACCOUNT_NAME'=>'Account Name', +'LBL_LIST_CITY'=>'City', +'LBL_LIST_WEBSITE'=>'Website', +'LBL_LIST_STATE'=>'State', +'LBL_LIST_PHONE'=>'Phone', +'LBL_LIST_EMAIL_ADDRESS'=>'Email Address', +'LBL_LIST_CONTACT_NAME'=>'Contact Name', + +//DON'T CONVERT THESE THEY ARE MAPPINGS +'db_name' => 'LBL_LIST_ACCOUNT_NAME', +'db_website' => 'LBL_LIST_WEBSITE', +'db_billing_address_city' => 'LBL_LIST_CITY', + +//END DON'T CONVERT + +'LBL_ACCOUNT'=>'Account:', +'LBL_ACCOUNT_NAME'=>'Account Name:', +'LBL_PHONE'=>'Phone:', +'LBL_WEBSITE'=>'Website:', +'LBL_FAX'=>'Fax:', +'LBL_TICKER_SYMBOL'=>'Ticker Symbol:', +'LBL_OTHER_PHONE'=>'Other Phone:', +'LBL_ANY_PHONE'=>'Any Phone:', +'LBL_MEMBER_OF'=>'Member of:', +'LBL_EMAIL'=>'Email:', +'LBL_EMPLOYEES'=>'Employees:', +'LBL_OTHER_EMAIL_ADDRESS'=>'Other Email:', +'LBL_ANY_EMAIL'=>'Any Email:', +'LBL_OWNERSHIP'=>'Ownership:', +'LBL_RATING'=>'Rating:', +'LBL_INDUSTRY'=>'Industry:', +'LBL_SIC_CODE'=>'SIC Code:', +'LBL_TYPE'=>'Type:', +'LBL_ANNUAL_REVENUE'=>'Annual Revenue:', +'LBL_ADDRESS_INFORMATION'=>'Address Information', +'LBL_Quote_INFORMATION'=>'Account Information', +'LBL_CUSTOM_INFORMATION'=>'Custom Information', +'LBL_BILLING_ADDRESS'=>'Billing Address:', +'LBL_SHIPPING_ADDRESS'=>'Shipping Address:', +'LBL_ANY_ADDRESS'=>'Any Address:', +'LBL_CITY'=>'City:', +'LBL_STATE'=>'State:', +'LBL_POSTAL_CODE'=>'Postal Code:', +'LBL_COUNTRY'=>'Country:', +'LBL_DESCRIPTION_INFORMATION'=>'Description Information', +'LBL_DESCRIPTION'=>'Description:', +'LBL_TERMS_INFORMATION'=>'Terms & Conditions', +'NTC_COPY_BILLING_ADDRESS'=>'Copy billing address to shipping address', +'NTC_COPY_SHIPPING_ADDRESS'=>'Copy shipping address to billing address', +'NTC_REMOVE_MEMBER_ORG_CONFIRMATION'=>'Are you sure you want to remove this record as a member organization?', +'LBL_DUPLICATE'=>'Potential Duplicate Accounts', +'MSG_DUPLICATE' => 'Creating this vtiger_account may vtiger_potentialy create a duplicate vtiger_account. You may either select an vtiger_account from the list below or you may click on Create New Account to continue creating a new vtiger_account with the previously entered data.', + +'LBL_INVITEE'=>'Contacts', +'ERR_DELETE_RECORD'=>"A record number must be specified to delete the vtiger_account.", + +'LBL_SELECT_ACCOUNT'=>'Select Account', +'LBL_GENERAL_INFORMATION'=>'General Information', + +//for v4 release added +'LBL_NEW_POTENTIAL'=>'New Potential', +'LBL_POTENTIAL_TITLE'=>'Potentials', + +'LBL_NEW_TASK'=>'New Task', +'LBL_TASK_TITLE'=>'Tasks', +'LBL_NEW_CALL'=>'New Call', +'LBL_CALL_TITLE'=>'Calls', +'LBL_NEW_MEETING'=>'New Meeting', +'LBL_MEETING_TITLE'=>'Meetings', +'LBL_NEW_EMAIL'=>'New Email', +'LBL_EMAIL_TITLE'=>'Emails', +'LBL_NEW_CONTACT'=>'New Contact', +'LBL_CONTACT_TITLE'=>'Contacts', + +//Added vtiger_fields after RC1 - Release +'LBL_ALL'=>'All', +'LBL_PROSPECT'=>'Prospect', +'LBL_INVESTOR'=>'Investor', +'LBL_RESELLER'=>'Reseller', +'LBL_PARTNER'=>'Partner', + +// Added for 4GA +'LBL_TOOL_FORM_TITLE'=>'Account Tools', +//Added for 4GA +'Subject'=>'Subject', +'Quote Name'=>'Quote Name', +'Vendor Name'=>'Vendor Name', +'Invoice Terms'=>'Invoice Terms', +'Contact Name'=>'Contact Name',//to include contact name vtiger_field in Invoice +'Invoice Date'=>'Invoice Date', +'Sub Total'=>'Sub Total', +'Due date'=>'Due Date', +'Carrier'=>'Carrier', +'Type'=>'Type', +'Sales Tax'=>'Sales Tax', +'Sales Commission'=>'Sales Commission', +'Excise Duty'=>'Excise Duty', +'Total'=>'Total', +'Product Name'=>'Product Name', +'Assigned To'=>'Assigned To', +'Billing Address'=>'Billing Address', +'Shipping Address'=>'Shipping Address', +'Billing City'=>'Billing City', +'Billing State'=>'Billing State', +'Billing Code'=>'Billing Postal Code', +'Billing Country'=>'Billing Country', +'Billing Po Box'=>'Billing PO Box', +'Shipping Po Box'=>'Shipping PO Box', +'Shipping City'=>'Shipping City', +'Shipping State'=>'Shipping State', +'Shipping Code'=>'Shipping Postal Code', +'Shipping Country'=>'Shipping Country', +'City'=>'City', +'State'=>'State', +'Code'=>'Code', +'Country'=>'Country', +'Created Time'=>'Created Time', +'Modified Time'=>'Modified Time', +'Description'=>'Description', +'Potential Name'=>'Potential Name', +'Customer No'=>'Customer No', +'Sales Order'=>'Sales Order', +'Pending'=>'Pending', +'Account Name'=>'Account Name', +'Terms & Conditions'=>'Terms & Conditions', +//Quote Info +'LBL_INVOICE_INFORMATION'=>'Invoice Information', +'LBL_INVOICE'=>'Invoice:', +'LBL_SO_INFORMATION'=>'Sales Order Information', +'LBL_SO'=>'Sales Order:', + +//Added in release 4.2 +'LBL_SUBJECT'=>'Subject:', +'LBL_SALES_ORDER'=>'Sales order:', +'Invoice Id'=>'Invoice Id', +'LBL_MY_TOP_INVOICE'=>'My Top Open Invoice', +'LBL_INVOICE_NAME'=>'Invoice Name:', +'Purchase Order'=>'Purchase Order', +'Status'=>'Status', +'Id'=>'Invoice Id', +'Invoice'=>'Invoice', + +//Added for existing Picklist Entries + +'Created'=>'Created', +'Approved'=>'Approved', +'Sent'=>'Sent', +'Credit Invoice'=>'Credit Invoice', +'Paid'=>'Paid', +'AutoCreated'=>'AutoCreated', +//Added to Custom Invoice Number +'Invoice No'=>'Invoice No', +'Adjustment'=>'Adjustment', + +//Added for Reports (5.0.4) +'Tax Type'=>'Tax Type', +'Discount Percent'=>'Discount Percent', +'Discount Amount'=>'Discount Amount', +'Terms & Conditions'=>'Terms & Conditions', +'No'=>'No', +'Date'=>'Date', + +// Added affter 5.0.4 GA +//Added for Documents module +'Documents'=>'Documents', +); + +?> diff --git a/oss/vtiger/trunk/modules/Invoice/language/zh_cn.lang.php b/oss/vtiger/trunk/modules/Invoice/language/zh_cn.lang.php new file mode 100644 index 00000000..8fe18ab1 --- /dev/null +++ b/oss/vtiger/trunk/modules/Invoice/language/zh_cn.lang.php @@ -0,0 +1,201 @@ + '发票', + 'LBL_SO_MODULE_NAME' => '发票', + 'LBL_RELATED_PRODUCTS' => '在线清单', + 'LBL_MODULE_TITLE' => '发票:首页', + 'LBL_SEARCH_FORM_TITLE' => '搜寻发票', + 'LBL_LIST_FORM_TITLE' => '发票列表', + 'LBL_LIST_SO_FORM_TITLE' => '销售列表', + 'LBL_NEW_FORM_TITLE' => '新增发票', + 'LBL_NEW_FORM_SO_TITLE' => '新增销售', + 'LBL_MEMBER_ORG_FORM_TITLE' => '会员所属单位', + +'LBL_LIST_ACCOUNT_NAME' => '客户名称', + 'LBL_LIST_CITY' => '乡镇市区', + 'LBL_LIST_WEBSITE' => '网站', + 'LBL_LIST_STATE' => '市(县)', + 'LBL_LIST_PHONE' => '电话', + 'LBL_LIST_EMAIL_ADDRESS' => '电子邮件', + 'LBL_LIST_CONTACT_NAME' => '联络人名称', + +//DON'T CONVERT THESE THEY ARE MAPPINGS +'db_name' => 'LBL_LIST_ACCOUNT_NAME', +'db_website' => 'LBL_LIST_WEBSITE', +'db_billing_address_city' => 'LBL_LIST_CITY', + +//END DON'T CONVERT + + 'LBL_ACCOUNT' => '客户:', + 'LBL_ACCOUNT_NAME' => '客户名称:', + 'LBL_PHONE' => '电话:', + 'LBL_WEBSITE' => '网站:', + 'LBL_FAX' => '传真:', + 'LBL_TICKER_SYMBOL' => '传票符号:', + 'LBL_OTHER_PHONE' => '其它电话:', + 'LBL_ANY_PHONE' => '其它电话:', + 'LBL_MEMBER_OF' => '会员:', + 'LBL_EMAIL' => '电子信箱:', + 'LBL_EMPLOYEES' => '员工数:', + 'LBL_OTHER_EMAIL_ADDRESS' => '其它电子信箱:', + 'LBL_ANY_EMAIL' => '其它电子信箱:', + 'LBL_OWNERSHIP' => '负责人:', + 'LBL_RATING' => '评分:', +'LBL_INDUSTRY' => '产业别:', + 'LBL_SIC_CODE' => '统一编号:', + 'LBL_TYPE' => '类型:', + 'LBL_ANNUAL_REVENUE' => '年收入:', + 'LBL_ADDRESS_INFORMATION' => '地址信息', + 'LBL_Quote_INFORMATION' => '客户信息', + 'LBL_CUSTOM_INFORMATION' => '自订信息', + 'LBL_BILLING_ADDRESS' => '发票地址:', + 'LBL_SHIPPING_ADDRESS' => '送货地址:', + 'LBL_ANY_ADDRESS' => '任一地址:', + 'LBL_CITY' => '乡镇市区:', + 'LBL_STATE' => '市(县):', + 'LBL_POSTAL_CODE' => '邮政编码:', + 'LBL_COUNTRY' => '省(市/自治区):', + 'LBL_DESCRIPTION_INFORMATION' => '细节内容', + 'LBL_DESCRIPTION' => '描述:', + 'LBL_TERMS_INFORMATION' => '限制与条件', + 'NTC_COPY_BILLING_ADDRESS' => '复制发票地址到送货地址', + 'NTC_COPY_SHIPPING_ADDRESS' => '复制送货地址到发票地址', + 'NTC_REMOVE_MEMBER_ORG_CONFIRMATION' => '您确定要移除这笔会员所属单位记录?', + 'LBL_DUPLICATE' => '潜在案件内容复制到客户', + 'MSG_DUPLICATE' => '建立这笔客户数据来自于潜在案件内容,您可以点选客户列表中的客户以复制建立新的客户,并且继承它的相关数据。', + + 'LBL_INVITEE' => '联络人', + 'ERR_DELETE_RECORD' => '必须指定一笔记录编号才能够删除客户。', + 'LBL_SELECT_ACCOUNT' => '选择客户', + 'LBL_GENERAL_INFORMATION' => '一般信息', + +//for v4 release added + 'LBL_NEW_POTENTIAL' => '新增潜在案件', + 'LBL_POTENTIAL_TITLE' => '潜在案件', + + 'LBL_NEW_TASK' => '新增任务', + 'LBL_TASK_TITLE' => '任务', + 'LBL_NEW_CALL' => '新增电话记录', + 'LBL_CALL_TITLE' => '电话记录', + 'LBL_NEW_MEETING' => '新增会议记录', + 'LBL_MEETING_TITLE' => '会议', + 'LBL_NEW_EMAIL' => '新增电子邮件', + 'LBL_EMAIL_TITLE' => '邮件', + 'LBL_NEW_CONTACT' => '新增联络人', + 'LBL_CONTACT_TITLE' => '联络人', + +//Added vtiger_fields after RC1 - Release + 'LBL_ALL' => '全部', + 'LBL_PROSPECT' => '期望', + 'LBL_INVESTOR' => '投资者', + 'LBL_RESELLER' => '转售人', + 'LBL_PARTNER' => '伙伴', + +// Added for 4GA + 'LBL_TOOL_FORM_TITLE' => '客户工具', +//Added for 4GA +'Subject' => '标题', +'Quote Name' => '报价名称', +'Vendor Name' => '卖方名称', +'Invoice Terms' => '发票期限', +'Contact Name' => '联络人名称',//to include contact name vtiger_field in Invoice +'Invoice Date' => '发票日期', +'Sub Total' => '小计', +'Issued Date' => '创建日期', +'Due Date' => '应付日期', +'Carrier' => '货运商', +'Type' => '类型', +'Sales Tax' => '销售税金', +'Sales Commission' => '销售佣金', +'Excise Duty' => '营业税', +'Total' => '总计 ', +'Product Name' => '商品名称', +'Assigned To' => '负责人', +'Billing Address' => '发票地址', +'Shipping Address' => '送货地址', +'Billing City' => '[发票地址]乡镇市区', +'Billing State' => '[发票地址]市(县)', +'Billing Code' => '[发票地址]邮政编码', +'Billing Country' => '[发票地址]省(市/自治区)', +'Billing Po Box' => '[发票地址]邮政信箱', +'Shipping Po Box' => '[送货地址]邮政信箱', +'Shipping City' => '[送货地址]乡镇市区', +'Shipping State' => '[送货地址]市(县)', +'Shipping Code' => '[送货地址]邮政编码', +'Shipping Country' => '[送货地址]省(市/自治区)', +'City' => '乡镇市区', + 'State' => '市(县)', + 'Code' => '邮政编码', + 'Country' => '省(市/自治区)', + 'Created Time' => '建档时间', + 'Modified Time' => '修改时间', + 'Description' => '细节内容', + 'Potential Name' => '潜在案件名称', + 'Customer No' => '客户编号', + 'Sales Order' => '销售', + 'Notes' => '备忘录', + 'Pending' => '期间', + 'Account Name' => '客户名称', + 'Terms & Conditions' => '限制与条件', +//Quote Info + 'LBL_INVOICE_INFORMATION' => '发票信息', + 'LBL_INVOICE' => '发票:', + 'LBL_SO_INFORMATION' => '销售订单信息', + 'LBL_SO' => '销售订单:', + +//Added in release 4.2 + 'LBL_SUBJECT' => '主旨:', + 'LBL_SALES_ORDER' => '销售订单:', + 'Invoice Id' => '发票号码', + 'LBL_MY_TOP_INVOICE' => '自己未处理的发票', + 'LBL_INVOICE_NAME' => '发票名称:', + 'Purchase Order' => '采购订单', + 'Status' => '状态', + 'Id' => '发票编号', + 'Invoice' => '发票', + +//Added for existing Picklist Entries + + 'Created' => '已建立', + 'Approved' => '已审核', + 'Sent' => '已寄送', + 'Credit Invoice' => '贷方发票', + 'Paid' => '已付款', +//Added to Custom Invoice Number +'Invoice No'=>'发票号码', +'Adjustment'=>'调整', +//Added for Reports (5.0.4) +'Tax Type'=>'Tax Type', +'Discount Percent'=>'Discount Percent', +'Discount Amount'=>'Discount Amount', +'Terms & Conditions'=>'Terms & Conditions', +'No'=>'No', +'Date'=>'Date', + +// Added affter 5.0.4 GA +//Added for Documents module +'Documents'=>'Documents', +); + +?> diff --git a/oss/vtiger/trunk/modules/Invoice/pdf_templates/footer.php b/oss/vtiger/trunk/modules/Invoice/pdf_templates/footer.php new file mode 100644 index 00000000..e5b2b016 --- /dev/null +++ b/oss/vtiger/trunk/modules/Invoice/pdf_templates/footer.php @@ -0,0 +1,35 @@ +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 *********************** */ + + +?> diff --git a/oss/vtiger/trunk/modules/Invoice/pdf_templates/header.php b/oss/vtiger/trunk/modules/Invoice/pdf_templates/header.php new file mode 100644 index 00000000..5965594a --- /dev/null +++ b/oss/vtiger/trunk/modules/Invoice/pdf_templates/header.php @@ -0,0 +1,104 @@ +addImage( $logo_name, $imageBlock); + +// x,y,width +if($org_phone != '') + $phone ="\n".$app_strings["Phone"].":".$org_phone; + +$companyBlockPositions=array( "10","23","62" ); +$companyText=$org_address."\n".$org_city.", ".$org_state." ".$org_code." ".$org_country." ".$phone."\n".$org_website; +$pdf->addTextBlock( $org_name, $companyText ,$companyBlockPositions ); + +// ************** End company information ******************* + + + +// ************* Begin Top-Right Header *************** +// title +$titleBlock=array("147","7"); +$pdf->title( $app_strings["Invoice"],"", $titleBlock ); + +$soBubble=array("168","17","12"); +$pdf->addBubbleBlock($so_name, $app_strings["SalesOrder"], $soBubble); + +$poBubble=array("114","17","12"); +$pdf->addBubbleBlock($po_name, $app_strings["PurchaseOrder"], $poBubble); + +// page number +$pageBubble=array("147","17",0); +$pdf->addBubbleBlock($page_num, $app_strings["Page"], $pageBubble); +// ************** End Top-Right Header ***************** + + + +// ************** Begin Addresses ************** +// shipping Address +$shipLocation = array("147","40","61"); +if(trim($ship_street)!='') + $shipText = $ship_street."\n"; +if(trim($ship_city) !='') + $shipText .= $ship_city.", "; +if(trim($ship_state)!='' || trim($ship_code)!= '') + $shipText .= $ship_state." ".$ship_code."\n"; + + $shipText .=$ship_country; + +$pdf->addTextBlock( $app_strings["Shipping Address"].":", $shipText, $shipLocation ); + +// billing Address +$billPositions = array("10","51","61"); +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); +// ********** End Addresses ****************** + + + +/* ******** Begin Invoice Data ************************ */ +// terms block +$termBlock=array("10","67"); +$pdf->addRecBlock($account_name, $app_strings["Customer Name"], $termBlock); + +// issue date block +$issueBlock=array("80","37"); +$pdf->addRecBlock(getDisplayDate(date("Y-m-d")), $app_strings["Issue Date"],$issueBlock); + +// due date block +$dueBlock=array("81","52"); +$pdf->addRecBlock($valid_till, $app_strings["Due Date"],$dueBlock); + +// Contact Name block +$conBlock=array("79","67"); +$pdf->addRecBlock($contact_name, $app_strings["Contact Name"],$conBlock); + +// vtiger_invoice number block +$invBlock=array("145","67"); +$pdf->addRecBlock($invoice_no, $app_strings["Invoice Number"],$invBlock); + +/* ************ End Invoice Data ************************ */ + + + +?> diff --git a/oss/vtiger/trunk/modules/Invoice/pdf_templates/lastpage/body.php b/oss/vtiger/trunk/modules/Invoice/pdf_templates/lastpage/body.php new file mode 100644 index 00000000..fc4720c1 --- /dev/null +++ b/oss/vtiger/trunk/modules/Invoice/pdf_templates/lastpage/body.php @@ -0,0 +1,62 @@ +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 *********************** */ + + +?> diff --git a/oss/vtiger/trunk/modules/Invoice/pdf_templates/lastpage/footer.php b/oss/vtiger/trunk/modules/Invoice/pdf_templates/lastpage/footer.php new file mode 100644 index 00000000..67de6bfb --- /dev/null +++ b/oss/vtiger/trunk/modules/Invoice/pdf_templates/lastpage/footer.php @@ -0,0 +1,59 @@ +drawLine($linePos); + $i = (($i+$width)+$pad)-1; +} + +// company addy +if($org_phone != '') +$phone="\n".$app_strings["Phone"].": ".$org_phone; +if($org_fax != '') + $fax ="\nFax: ".$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); + +?> diff --git a/oss/vtiger/trunk/modules/Invoice/updateRelations.php b/oss/vtiger/trunk/modules/Invoice/updateRelations.php new file mode 100644 index 00000000..85798501 --- /dev/null +++ b/oss/vtiger/trunk/modules/Invoice/updateRelations.php @@ -0,0 +1,48 @@ +pquery("insert into vtiger_senotesrel values (?,?)", array($forCRMRecord,$id)); + else { + $focus->save_related_module($currentModule, $forCRMRecord, $dest_mod, $id); + } + } +} + +header("Location: index.php?action=$action&module=$currentModule&record=".$forCRMRecord."&parenttab=".$parenttab); + +?> \ No newline at end of file