diff --git a/htdocs/admin/receiptprinter.php b/htdocs/admin/receiptprinter.php
index 8730f148c07..76aaa14d84c 100644
--- a/htdocs/admin/receiptprinter.php
+++ b/htdocs/admin/receiptprinter.php
@@ -260,7 +260,8 @@ if ($mode == 'config' && $user->admin) {
print '';
}
- dol_fiche_head($head, $mode, $langs->trans("ModuleSetup"), 0, 'technic');
+
+ dol_fiche_head($head, $mode, $langs->trans("ModuleSetup"), -1, 'technic');
print $langs->trans("ReceiptPrinterDesc")."
\n";
@@ -346,11 +347,11 @@ if ($mode == 'config' && $user->admin) {
}
print '';
- print '
';
+ print '
';
- dol_fiche_head();
- print $langs->trans("ReceiptPrinterTypeDesc")."
\n";
+ print load_fiche_titre($langs->trans("ReceiptPrinterTypeDesc"), '', '')."\n";
+
print ''."\n";
print '| '.$langs->trans("CONNECTOR_DUMMY").': | '.$langs->trans("CONNECTOR_DUMMY_HELP").' |
';
print '| '.$langs->trans("CONNECTOR_NETWORK_PRINT").': | '.$langs->trans("CONNECTOR_NETWORK_PRINT_HELP").' |
';
@@ -358,12 +359,12 @@ if ($mode == 'config' && $user->admin) {
print '| '.$langs->trans("CONNECTOR_WINDOWS_PRINT").': | '.$langs->trans("CONNECTOR_WINDOWS_PRINT_HELP").' |
';
print '| '.$langs->trans("CONNECTOR_CUPS_PRINT").': | '.$langs->trans("CONNECTOR_CUPS_PRINT_HELP").' |
';
print '
';
- dol_fiche_end();
- print '';
+ print '
';
+
+
+ print load_fiche_titre($langs->trans("ReceiptPrinterProfileDesc"), '', '')."\n";
- dol_fiche_head();
- print $langs->trans("ReceiptPrinterProfileDesc")."
\n";
print ''."\n";
print '| '.$langs->trans("PROFILE_DEFAULT").': | '.$langs->trans("PROFILE_DEFAULT_HELP").' |
';
print '| '.$langs->trans("PROFILE_SIMPLE").': | '.$langs->trans("PROFILE_SIMPLE_HELP").' |
';
@@ -371,7 +372,6 @@ if ($mode == 'config' && $user->admin) {
print '| '.$langs->trans("PROFILE_P822D").': | '.$langs->trans("PROFILE_P822D_HELP").' |
';
print '| '.$langs->trans("PROFILE_STAR").': | '.$langs->trans("PROFILE_STAR_HELP").' |
';
print '
';
- dol_fiche_end();
}
if ($mode == 'template' && $user->admin) {
@@ -383,9 +383,9 @@ if ($mode == 'template' && $user->admin) {
print '';
}
- dol_fiche_head($head, $mode, $langs->trans("ModuleSetup"), 0, 'technic');
- print $langs->trans("ReceiptPrinterTemplateDesc")."
\n";
+ print load_fiche_titre($langs->trans("ReceiptPrinterTemplateDesc"), '', '')."
\n";
+
print ''."\n";
print '';
print '| '.$langs->trans("Name").' | ';
@@ -412,15 +412,15 @@ if ($mode == 'template' && $user->admin) {
print ''.$printer->listprinterstemplates[$line]['name'].' | ';
print ''.nl2br(htmlentities($printer->listprinterstemplates[$line]['template'])).' | ';
// edit icon
- print '';
+ print ' | ';
print img_picto($langs->trans("Edit"), 'edit');
print '';
// delete icon
- print '';
+ print '';
print img_picto($langs->trans("Delete"), 'delete');
print '';
// test icon
- print '';
+ print '';
print img_picto($langs->trans("TestPrinterTemplate"), 'printer');
print ' | ';
}
@@ -441,21 +441,22 @@ if ($mode == 'template' && $user->admin) {
print '';
}
print '';
- print '';
+
+ print '
';
+
print ''."\n";
print '';
print '| '.$langs->trans("Tag").' | ';
print ''.$langs->trans("Description").' | ';
print "
\n";
- $max = count($printer->tags);
- for ($tag = 0; $tag < $max; $tag++) {
+
+ $langs->loadLangs(array("bills", "companies"));
+ foreach ($printer->tags as $key => $val) {
print '';
- print '| <'.$printer->tags[$tag].'> | '.$langs->trans(strtoupper($printer->tags[$tag])).' | ';
+ print '<'.$key.'> | '.$langs->trans($val).' | ';
print '
';
}
print '
';
-
- dol_fiche_end();
}
// End of page
diff --git a/htdocs/core/class/dolreceiptprinter.class.php b/htdocs/core/class/dolreceiptprinter.class.php
index f921e8ad638..8d9c449b972 100644
--- a/htdocs/core/class/dolreceiptprinter.class.php
+++ b/htdocs/core/class/dolreceiptprinter.class.php
@@ -158,79 +158,72 @@ class dolReceiptPrinter extends Printer
{
$this->db = $db;
$this->tags = array(
- 'dol_line_feed',
- 'dol_line_feed_reverse',
- 'dol_align_left',
- 'dol_align_center',
- 'dol_align_right',
- 'dol_use_font_a',
- 'dol_use_font_b',
- 'dol_use_font_c',
- 'dol_bold',
- 'dol_bold_disabled',
- 'dol_double_height',
- 'dol_double_width',
- 'dol_default_height_width',
- 'dol_underline',
- 'dol_underline_disabled',
- 'dol_cut_paper_full',
- 'dol_cut_paper_partial',
- 'dol_open_drawer',
- 'dol_beep',
- 'dol_print_text',
- 'dol_print_barcode',
- 'dol_value_date',
- 'dol_value_date_time',
- 'dol_value_year',
- 'dol_value_month_letters',
- 'dol_value_month',
- 'dol_value_day',
- 'dol_value_day_letters',
+ 'dol_line_feed' => 'DOL_LINE_FEED',
+ 'dol_line_feed_reverse' => 'DOL_LINE_FEED_REVERSE',
+ 'dol_align_left' => 'DOL_ALIGN_LEFT',
+ 'dol_align_center' => 'DOL_ALIGN_CENTER',
+ 'dol_align_right' => 'DOL_ALIGN_RIGHT',
+ 'dol_use_font_a' => 'DOL_USE_FONT_A',
+ 'dol_use_font_b' => 'DOL_USE_FONT_B',
+ 'dol_use_font_c' => 'DOL_USE_FONT_C',
+ 'dol_bold' => 'DOL_BOLD',
+ 'dol_bold_disabled' => 'DOL_BOLD_DISABLED',
+ 'dol_double_height' => 'DOL_DOUBLE_HEIGHT',
+ 'dol_double_width' => 'DOL_DOUBLE_WIDTH',
+ 'dol_default_height_width' => 'DOL_DEFAULT_HEIGHT_WIDTH',
+ 'dol_underline' => 'DOL_UNDERLINE',
+ 'dol_underline_disabled' => 'DOL_UNDERLINE_DISABLED',
+ 'dol_cut_paper_full' => 'DOL_CUT_PAPER_FULL',
+ 'dol_cut_paper_partial' => 'DOL_CUT_PAPER_PARTIAL',
+ 'dol_open_drawer' => 'DOL_OPEN_DRAWER',
+ 'dol_beep' => 'DOL_BEEP',
+ 'dol_print_text' => 'DOL_PRINT_TEXT',
+ 'dol_print_barcode' => 'DOL_PRINT_BARCODE',
+ 'dol_value_date' => 'DateInvoice',
+ 'dol_value_date_time' => 'DateInvoiceWithTime',
+ 'dol_value_year' => 'YearInvoice',
+ 'dol_value_month_letters' => 'DOL_VALUE_MONTH_LETTERS',
+ 'dol_value_month' => 'DOL_VALUE_MONTH',
+ 'dol_value_day' => 'DOL_VALUE_DAY',
+ 'dol_value_day_letters' => 'DOL_VALUE_DAY',
//'dol_print_payment',
- 'dol_print_logo',
- 'dol_print_logo_old',
- 'dol_value_object_id',
- 'dol_value_object_ref',
- 'dol_print_object_lines',
- 'dol_print_object_tax',
- 'dol_print_object_local_tax',
- 'dol_print_object_total',
- 'dol_print_object_number',
- 'dol_print_order_lines',
- 'dol_value_customer_firstname',
- 'dol_value_customer_lastname',
- 'dol_value_customer_mail',
- 'dol_value_customer_phone',
- 'dol_value_customer_mobile',
- 'dol_value_customer_skype',
- 'dol_value_customer_tax_number',
- 'dol_value_customer_account_balance',
- 'dol_value_mysoc_name',
- 'dol_value_mysoc_address',
- 'dol_value_mysoc_zip',
- 'dol_value_mysoc_town',
- 'dol_value_mysoc_country',
- 'dol_value_mysoc_idprof1',
- 'dol_value_mysoc_idprof2',
- 'dol_value_mysoc_idprof3',
- 'dol_value_mysoc_idprof4',
- 'dol_value_mysoc_idprof5',
- 'dol_value_mysoc_idprof6',
- 'dol_value_mysoc_tva_intra',
- 'dol_value_mysoc_capital',
- 'dol_value_vendor_lastname',
- 'dol_value_vendor_firstname',
- 'dol_value_vendor_mail',
- 'dol_value_customer_points',
- 'dol_value_object_points',
- //'dol_print_if_customer',
- //'dol_print_if_vendor',
- //'dol_print_if_happy_hour',
- //'dol_print_if_num_object_unique',
- //'dol_print_if_customer_points',
- //'dol_print_if_object_points',
- //'dol_print_if_customer_tax_number',
- //'dol_print_if_customer_account_balance_positive',
+ 'dol_print_logo' => 'DOL_PRINT_LOGO',
+ 'dol_print_logo_old' => 'DOL_PRINT_LOGO_OLD',
+ 'dol_value_object_id' => 'InvoiceID',
+ 'dol_value_object_ref' => 'InvoiceRef',
+ 'dol_print_object_lines' => 'DOL_PRINT_OBJECT_LINES',
+ 'dol_print_object_tax' => 'TotalVAT',
+ 'dol_print_object_local_tax1' => 'TotalLT1',
+ 'dol_print_object_local_tax2' => 'TotalLT2',
+ 'dol_print_object_total' => 'Total',
+ 'dol_print_object_number' => 'DOL_PRINT_OBJECT_NUMBER',
+ 'dol_value_object_points' => 'DOL_VALUE_OBJECT_POINTS',
+ 'dol_print_order_lines' => 'DOL_PRINT_ORDER_LINES',
+ 'dol_value_customer_firstname' => 'DOL_VALUE_CUSTOMER_FIRSTNAME',
+ 'dol_value_customer_lastname' => 'DOL_VALUE_CUSTOMER_LASTNAME',
+ 'dol_value_customer_mail' => 'DOL_VALUE_CUSTOMER_MAIL',
+ 'dol_value_customer_phone' => 'DOL_VALUE_CUSTOMER_PHONE',
+ 'dol_value_customer_mobile' => 'DOL_VALUE_CUSTOMER_MOBILE',
+ 'dol_value_customer_skype' => 'DOL_VALUE_CUSTOMER_SKYPE',
+ 'dol_value_customer_tax_number' => 'DOL_VALUE_CUSTOMER_TAX_NUMBER',
+ 'dol_value_customer_account_balance' => 'DOL_VALUE_CUSTOMER_ACCOUNT_BALANCE',
+ 'dol_value_customer_points' => 'DOL_VALUE_CUSTOMER_POINTS',
+ 'dol_value_mysoc_name' => 'DOL_VALUE_MYSOC_NAME',
+ 'dol_value_mysoc_address' => 'Address',
+ 'dol_value_mysoc_zip' => 'Zip',
+ 'dol_value_mysoc_town' => 'Town',
+ 'dol_value_mysoc_country' => 'Country',
+ 'dol_value_mysoc_idprof1' => 'ProfId1',
+ 'dol_value_mysoc_idprof2' => 'ProfId2',
+ 'dol_value_mysoc_idprof3' => 'ProfId3',
+ 'dol_value_mysoc_idprof4' => 'ProfId4',
+ 'dol_value_mysoc_idprof5' => 'ProfId5',
+ 'dol_value_mysoc_idprof6' => 'ProfId6',
+ 'dol_value_mysoc_tva_intra' => 'VATIntra',
+ 'dol_value_mysoc_capital' => 'Capital',
+ 'dol_value_vendor_lastname' => 'VendorLastname',
+ 'dol_value_vendor_firstname' => 'VendorFirstname',
+ 'dol_value_vendor_mail' => 'VendorEmail',
);
}
@@ -545,14 +538,14 @@ class dolReceiptPrinter extends Printer
/**
* Function to Print Receipt Ticket
*
- * @param object $object order or invoice object
- * @param int $templateid Template id
- * @param int $printerid Printer id
- * @return int 0 if OK; >0 if KO
+ * @param Facture|Commande $object Order or invoice object
+ * @param int $templateid Template id
+ * @param int $printerid Printer id
+ * @return int 0 if OK; >0 if KO
*/
public function sendToPrinter($object, $templateid, $printerid)
{
- global $conf, $mysoc, $langs;
+ global $conf, $mysoc, $langs, $user;
$error = 0;
$ret = $this->loadTemplate($templateid);
@@ -560,15 +553,23 @@ class dolReceiptPrinter extends Printer
$this->template = str_replace('', $object->id, $this->template);
$this->template = str_replace('', $object->ref, $this->template);
$this->template = str_replace('', $object->points, $this->template);
- $this->template = str_replace('', $object->customer_firstname, $this->template);
- $this->template = str_replace('', $object->customer_lastname, $this->template);
- $this->template = str_replace('', $object->customer_mail, $this->template);
- $this->template = str_replace('', $object->customer_phone, $this->template);
- $this->template = str_replace('', $object->customer_mobile, $this->template);
- $this->template = str_replace('', $object->customer_skype, $this->template);
- $this->template = str_replace('', $object->customer_tax_number, $this->template);
+ $this->template = str_replace('', dol_print_date($object->date, 'day'), $this->template);
+ $this->template = str_replace('', dol_print_date($object->date, 'dayhour'), $this->template);
+ $this->template = str_replace('', dol_print_date($object->date, '%Y'), $this->template);
+ $this->template = str_replace('', $langs->trans("Month".dol_print_date($object->date, '%m')), $this->template);
+ $this->template = str_replace('', dol_print_date($object->date, '%m'), $this->template);
+ $this->template = str_replace('', dol_print_date($object->date, '%d'), $this->template);
+ $this->template = str_replace('', $langs->trans("Day".dol_print_date($object->date, '%m')[1]), $this->template);
+
+ $this->template = str_replace('', $object->thirdparty->firstname, $this->template);
+ $this->template = str_replace('', $object->thirdparty->lastname, $this->template);
+ $this->template = str_replace('', $object->thirdparty->mail, $this->template);
+ $this->template = str_replace('', $object->thirdparty->phone, $this->template);
+ $this->template = str_replace('', $object->thirdparty->mobile, $this->template);
+ $this->template = str_replace('', $object->thirdparty->vatintra, $this->template);
$this->template = str_replace('', $object->customer_account_balance, $this->template);
$this->template = str_replace('', $object->customer_points, $this->template);
+
$this->template = str_replace('', $mysoc->name, $this->template);
$this->template = str_replace('', $mysoc->address, $this->template);
$this->template = str_replace('', $mysoc->zip, $this->template);
@@ -582,16 +583,10 @@ class dolReceiptPrinter extends Printer
$this->template = str_replace('', $mysoc->idprof6, $this->template);
$this->template = str_replace('', $mysoc->tva_intra, $this->template);
$this->template = str_replace('', $mysoc->capital, $this->template);
- $this->template = str_replace('', $object->vendor_firstname, $this->template);
- $this->template = str_replace('', $object->vendor_lastname, $this->template);
- $this->template = str_replace('', $object->vendor_mail, $this->template);
- $this->template = str_replace('', dol_print_date($object->date, 'day'), $this->template);
- $this->template = str_replace('', dol_print_date($object->date, 'dayhour'), $this->template);
- $this->template = str_replace('', dol_print_date($object->date, '%Y'), $this->template);
- $this->template = str_replace('', $langs->trans("Month".dol_print_date($object->date, '%m')), $this->template);
- $this->template = str_replace('', dol_print_date($object->date, '%m'), $this->template);
- $this->template = str_replace('', dol_print_date($object->date, '%d'), $this->template);
- $this->template = str_replace('', $langs->trans("Day".dol_print_date($object->date, '%m')[1]), $this->template);
+
+ $this->template = str_replace('', $user->firstname, $this->template);
+ $this->template = str_replace('', $user->lastname, $this->template);
+ $this->template = str_replace('', $user->email, $this->template);
// parse template
$p = xml_parser_create();
@@ -634,6 +629,26 @@ class dolReceiptPrinter extends Printer
$this->printer->text($spaces.$vatkey.'% '.str_pad(price($vatvalue), 10, ' ', STR_PAD_LEFT)."\n");
}
break;
+ case 'DOL_PRINT_OBJECT_TAX1':
+ //var_dump($object);
+ $total_localtax1 = 0;
+ foreach ($object->lines as $line) {
+ $total_localtax1 += $line->total_localtax1;
+ }
+ foreach ($vatarray as $vatkey => $vatvalue) {
+ $this->printer->text(str_pad(price($total_localtax1), 10, ' ', STR_PAD_LEFT)."\n");
+ }
+ break;
+ case 'DOL_PRINT_OBJECT_TAX2':
+ //var_dump($object);
+ $total_localtax2 = 0;
+ foreach ($object->lines as $line) {
+ $total_localtax2 += $line->total_localtax2;
+ }
+ foreach ($vatarray as $vatkey => $vatvalue) {
+ $this->printer->text(str_pad(price($total_localtax2), 10, ' ', STR_PAD_LEFT)."\n");
+ }
+ break;
case 'DOL_PRINT_OBJECT_TOTAL':
$title = $langs->trans('TotalHT');
$spacestoadd = $nbcharactbyline - strlen($title) - 10;
diff --git a/htdocs/langs/en_US/receiptprinter.lang b/htdocs/langs/en_US/receiptprinter.lang
index 5533de0c320..83a003f388d 100644
--- a/htdocs/langs/en_US/receiptprinter.lang
+++ b/htdocs/langs/en_US/receiptprinter.lang
@@ -56,16 +56,15 @@ DOL_UNDERLINE=Enable underline
DOL_UNDERLINE_DISABLED=Disable underline
DOL_BEEP=Beed sound
DOL_PRINT_TEXT=Print text
-DOL_VALUE_DATE=Invoice date
-DOL_VALUE_DATE_TIME=Invoice date and time
-DOL_VALUE_YEAR=Invoice year
+DateInvoiceWithTime=Invoice date and time
+YearInvoice=Invoice year
DOL_VALUE_MONTH_LETTERS=Invoice month in letters
DOL_VALUE_MONTH=Invoice month
DOL_VALUE_DAY=Invoice day
DOL_VALUE_DAY_LETTERS=Inovice day in letters
DOL_LINE_FEED_REVERSE=Line feed reverse
-DOL_VALUE_OBJECT_ID=Invoice ID
-DOL_VALUE_OBJECT_REF=Invoice ref
+InvoiceID=Invoice ID
+InvoiceRef=Invoice ref
DOL_PRINT_OBJECT_LINES=Invoice lines
DOL_VALUE_CUSTOMER_FIRSTNAME=Customer first name
DOL_VALUE_CUSTOMER_LASTNAME=Customer last name
@@ -76,20 +75,8 @@ DOL_VALUE_CUSTOMER_SKYPE=Customer Skype
DOL_VALUE_CUSTOMER_TAX_NUMBER=Customer tax number
DOL_VALUE_CUSTOMER_ACCOUNT_BALANCE=Customer account balance
DOL_VALUE_MYSOC_NAME=Your company name
-DOL_VALUE_MYSOC_ADDRESS=Your company address
-DOL_VALUE_MYSOC_ZIP=Your zip code
-DOL_VALUE_MYSOC_TOWN=Your town
-DOL_VALUE_MYSOC_COUNTRY=Your country
-DOL_VALUE_MYSOC_IDPROF1=Your IDPROF1
-DOL_VALUE_MYSOC_IDPROF2=Your IDPROF2
-DOL_VALUE_MYSOC_IDPROF3=Your IDPROF3
-DOL_VALUE_MYSOC_IDPROF4=Your IDPROF4
-DOL_VALUE_MYSOC_IDPROF5=Your IDPROF5
-DOL_VALUE_MYSOC_IDPROF6=Your IDPROF6
-DOL_VALUE_MYSOC_TVA_INTRA=Intra-Community VAT ID
-DOL_VALUE_MYSOC_CAPITAL=Capital
-DOL_VALUE_VENDOR_LASTNAME=Vendor last name
-DOL_VALUE_VENDOR_FIRSTNAME=Vendor first name
-DOL_VALUE_VENDOR_MAIL=Vendor mail
+VendorLastname=Vendor last name
+VendorFirstname=Vendor first name
+VendorEmail=Vendor email
DOL_VALUE_CUSTOMER_POINTS=Customer points
DOL_VALUE_OBJECT_POINTS=Object points
\ No newline at end of file
diff --git a/htdocs/takepos/admin/receipt.php b/htdocs/takepos/admin/receipt.php
index 2f54d79d603..d7ae3ce7653 100644
--- a/htdocs/takepos/admin/receipt.php
+++ b/htdocs/takepos/admin/receipt.php
@@ -117,14 +117,22 @@ if ($conf->receiptprinter->enabled) {
print $langs->trans('DolibarrReceiptPrinter');
print '';
print $langs->trans('ReceiptPrinterMethodDescription');
+ print ' ';
+ print ''.$langs->trans("Setup").'';
print ' | ';
- if ($conf->global->TAKEPOS_PRINT_METHOD == "receiptprinter")
- {
- print img_picto($langs->trans("Activated"), 'switch_on');
- }
- else
- {
- print ''.img_picto($langs->trans("Disabled"), 'switch_off').'';
+ if ($conf->receiptprinter->enabled) {
+ if ($conf->global->TAKEPOS_PRINT_METHOD == "receiptprinter")
+ {
+ print img_picto($langs->trans("Activated"), 'switch_on');
+ }
+ else
+ {
+ print ''.img_picto($langs->trans("Disabled"), 'switch_off').'';
+ }
+ } else {
+ print '';
+ print $langs->trans("ModuleReceiptPrinterMustBeEnabled");
+ print '';
}
print " |
\n";
}