Explorar o código

commit inicial

Rodney Elpidio Enciso Arias %!s(int64=7) %!d(string=hai) anos
achega
8214da7e90
Modificáronse 6 ficheiros con 205 adicións e 0 borrados
  1. 0 0
      __init__.py
  2. BIN=BIN
      __init__.pyc
  3. 19 0
      __openerp__.py
  4. 69 0
      static/src/js/main.js
  5. 107 0
      static/src/xml/pos.xml
  6. 10 0
      views/pos_template.xml

+ 0 - 0
__init__.py


BIN=BIN
__init__.pyc


+ 19 - 0
__openerp__.py

@@ -0,0 +1,19 @@
+# -*- encoding: utf-8 -*-
+{
+    "name": "Eiru POS Bill Ticket",
+    "category": "Point Of Sale",
+    "version": "1.0",
+    'description': 'Impresion de Cuenta',
+    "depends": [
+        'point_of_sale'
+    ],
+    'data': [
+        "views/pos_template.xml",
+    ],
+    "qweb": [
+        'static/src/xml/pos.xml',
+    ],
+    "author": "Dhinesh D - Eiru",
+    "license": "AGPL-3",
+    "installable": True, 
+}

+ 69 - 0
static/src/js/main.js

@@ -0,0 +1,69 @@
+
+openerp.eiru_bill_ticket = function (instance) {
+	var module   = instance.point_of_sale;
+    var _t = instance.web._t,
+        _lt = instance.web._lt;
+    var QWeb = instance.web.qweb;
+
+    module.BillTicketScreenWidget = module.ScreenWidget.extend({
+        template: 'BillTicketScreenWidget',
+
+        show_numpad:     false,
+        show_leftpane:   false,
+
+        show: function(){
+            this._super();
+            var self = this;
+            var back_button  = this.add_action_button({
+                label: _t('Back'),
+                icon: '/point_of_sale/static/src/img/icons/png48/go-previous.png',
+                click: function(){  
+                    self.back();
+                },
+            });
+            this.refresh();
+        },
+
+        print: function() {
+            this.pos.get('selectedOrder')._printed = true;
+            window.print();
+        },
+        back: function(){
+            var previous = this.pos.get('selectedOrder').get_screen_data('previous-screen');
+            if(previous){
+                this.pos_widget.screen_selector.set_current_screen(previous);
+            }
+        },
+        refresh: function() {
+            var order = this.pos.get('selectedOrder');
+            $('.pos-receipt-container', this.$el).html(QWeb.render('BillTicket',{
+                widget:this,
+                order: order,
+                orderlines: order.get('orderLines').models,
+            }));
+        },
+    });
+
+    module.PosWidget.include({
+        build_widgets: function(){
+            var self = this;
+            this._super();
+
+            this.bill_ticket_screen = new module.BillTicketScreenWidget(this,{});
+            this.bill_ticket_screen.appendTo(this.$('.screens'));
+            this.screen_selector.add_screen('BillTicket',this.bill_ticket_screen);
+
+            var bill_ticket_button = $(QWeb.render('BillTicketButton'));
+
+            bill_ticket_button.click(function(){
+                if(self.pos.get('selectedOrder').get('orderLines').models.length > 0){
+                    self.pos_widget.screen_selector.set_current_screen('BillTicket');
+                }
+            });
+
+            bill_ticket_button.appendTo(this.$('.control-buttons'));
+            this.$('.control-buttons').removeClass('oe_hidden');
+        },
+    });
+
+};

+ 107 - 0
static/src/xml/pos.xml

@@ -0,0 +1,107 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<templates id="template" xml:space="preserve">
+    <t t-name="BillTicketScreenWidget">
+        <div class="receipt-screen screen touch-scrollable" >
+            <div class="pos-step-container">
+                <div class="pos-receipt-container">
+                </div>
+            </div>
+        </div>
+    </t>
+    <t t-name="BillTicketButton">
+        <span class="control-button order-printbill">
+            <i class="fa fa-print"></i>
+            Cuenta
+        </span>
+    </t>
+    <t t-name="BillTicket">
+        <div class="pos-sale-ticket" style='font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;font-size: 15px;'>
+
+            <div class="pos-center-align" style="font-size:25px;font-weight:bold">Cuenta</div>
+            <br/>
+
+            <div class="pos-center-align"><t t-esc="new Date().toString(Date.CultureInfo.formatPatterns.shortDate + ' ' +
+                Date.CultureInfo.formatPatterns.longTime)"/> 
+                <br/>
+                <t t-esc="order.get('name')"/></div>
+            <br/>
+            User: <t t-esc="widget.pos.cashier ? widget.pos.cashier.name : widget.pos.user.name"/><br />
+            <br />
+            <t t-if="widget.pos.config.receipt_header">
+                <div style='text-align:center;font-size: 30px;'>
+                    <t t-esc="widget.pos.config.receipt_header" />
+                </div>
+            </t>
+            <table class="table table-condensed">
+                <thead>
+                    <tr>
+                        <th>Producto</th>
+                        <th class="text-right">Cant.</th>
+                        <th class="text-right">Precio</th>
+                    </tr>
+                    <p>--------------------------------------------</p>
+                </thead>
+                <tbody>
+                    <colgroup>
+                        <col width='50%' />
+                        <col width='20%' />
+                        <col width='30%' />
+                    </colgroup>
+                    <tr t-foreach="orderlines" t-as="orderline">
+                        <td>
+                            <t t-esc="orderline.get_product().display_name"/>
+                             <t t-if="orderline.get_discount() > 0">
+                                <div class="pos-disc-font">
+                                    Con <t t-esc="orderline.get_discount()"/>% descuento
+                                </div>
+                            </t>
+                        </td>
+                        <td>
+                            <t t-esc="orderline.get_quantity_str_with_unit()"/>
+                        </td>
+                        <td class="pos-right-align">
+                            <t t-esc="widget.format_currency(orderline.get_display_price())"/>
+                        </td>
+                    </tr>
+                </tbody>
+            </table>
+            <p>--------------------------------------------</p>
+            <br />
+            <table>
+                <tr>
+                    <td>Subtotal:</td>
+                    <td class="pos-right-align">
+                        <t t-esc="widget.format_currency(order.getTotalTaxExcluded())"/>
+                    </td>
+                </tr>
+                <t t-foreach="order.getTaxDetails()" t-as="taxdetail">
+                    <tr>
+                        <td><t t-esc="taxdetail.name" /></td>
+                        <td class="pos-right-align">
+                            <t t-esc="widget.format_currency(taxdetail.amount)"/>
+                        </td>
+                    </tr>
+                </t>
+                <tr>
+                    <td>Descuento:</td>
+                    <td class="pos-right-align">
+                        <t t-esc="widget.format_currency(order.getDiscountTotal())"/>
+                    </td>
+                </tr>
+                <tr class="emph">
+                    <td>Total:</td>
+                    <td class="pos-right-align" style='font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;font-size: 20px;'>
+                        <t t-esc="widget.format_currency(order.getTotalTaxIncluded())"/>
+                    </td>
+                </tr>
+            </table>
+            <br />
+            <t t-if="widget.pos.config.receipt_footer">
+                <br />
+                <div style='text-align:center'>
+                    <t t-esc="widget.pos.config.receipt_footer" />
+                </div>
+            </t>
+        </div>
+    </t>
+</templates>

+ 10 - 0
views/pos_template.xml

@@ -0,0 +1,10 @@
+<openerp>
+    <data>
+        <template id="pos_bill_ticket_assets_backend" name="pos_bill_ticket_assets_backend" inherit_id="point_of_sale.assets_backend">
+            <xpath expr="." position="inside">
+                <script src="/eiru_bill_ticket/static/src/js/main.js"
+                        type="text/javascript"></script>
+            </xpath>
+        </template> 
+    </data>
+</openerp>