<?php

if (!defined('sugarEntry') || !sugarEntry)
    die('Not A Valid Entry Point');

/* * *******************************************************************************
 * SugarCRM is a customer relationship management program developed by
 * SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc.
 *
 * This program is free software; you can redistribute it and/or modify it under
 * the terms of the GNU General Public License version 3 as published by the
 * Free Software Foundation with the addition of the following permission added
 * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
 * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
 * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
 * details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program; if not, see http://www.gnu.org/licenses or write to the Free
 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 * 02110-1301 USA.
 *
 * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
 * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
 *
 * The interactive user interfaces in modified source and object code versions
 * of this program must display Appropriate Legal Notices, as required under
 * Section 5 of the GNU General Public License version 3.
 *
 * In accordance with Section 7(b) of the GNU General Public License version 3,
 * these Appropriate Legal Notices must retain the display of the "Powered by
 * SugarCRM" logo. If the display of the logo is not reasonably feasible for
 * technical reasons, the Appropriate Legal Notices must display the words
 *
 * "Powered by SugarCRM".
 * ****************************************************************************** */

$viewdefs['EcmReceipts']['EditView'] = array(
    'templateMeta' => array(
        'form' => array(
            'enctype' => 'multipart/form-data',
            'buttons' => array(
                array(
                    'customCode' =>
                    '
                    <input title="{$APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}" class="button" onclick="return SaveForm();" type="button" name="button" value="{$APP.LBL_SAVE_BUTTON_LABEL}">
                    ',
                ),
                array(
                    'customCode' =>
                    '
                    <input title="{$APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" class="button" onclick="window.location=\'index.php?module=EcmReceipts&action=index\';" type="button" name="button" value="{$APP.LBL_CANCEL_BUTTON_LABEL}">
                    ',
                ),
                array(
                    'customCode' =>
                    '
                    <input class="button" onclick="test();" type="button" name="button" value="test">
                    ',
                ),
            ),
            'hidden' => array(
                '
                <input type="hidden" name="position_list" id="position_list" value=\'{$POSITION_LIST}\'>
                ',
                '
                <input type="hidden" name="parent_type" id="parent_type" value="{$PARENT_TYPE}">
                ',
                '
                <input type="hidden" name="parent_doc_id" id="parent_doc_id" value="{$PARENT_DOC_ID}">
                ',
                '
                <input type="hidden" name="temp_id" id="temp_id" value=\'{$TEMP_ID}\'>
                ',
                '
                <input type="hidden" name="ecmlanguage" id="ecmlanguage" value=\'\'>
                ',
            ),
        ),
        'maxColumns' => '2',
        'widths' => array(
            array(
                'label' => '10',
                'field' => '30',
            ),
            array(
                'label' => '10',
                'field' => '30',
            ),
        ),
        'includes' => array(
            array(
                'file' => 'include/JSON.js',
            ),
            array(
                'file' => 'include/javascript/quicksearch.js',
            ),
            array(
                'file' => 'include/ECM/EcmPreviewPDF/EcmPreviewPDF.js',
            ),
            array(
                'file' => 'modules/EcmReceipts/AjaxSearch/AjaxSearch.js',
            ),
            array(
                'file' => 'modules/EcmReceipts/formloader.js',
            ),
            array(
                'file' => 'modules/EcmReceipts/MyTable.js',
            ),
            array(
                'file' => 'modules/EcmReceipts/EcmReceipts.js',
            ),
            array(
                'file' => 'modules/EcmProducts/mintajax.js',
            ),
            array(
                'file' => 'modules/EcmProducts/helper.js',
            ),
        ),
    ),
    'panels' => array(
        'LBL_DETAILS_TAB' => array(
            array(
                array(
                    'name' => 'document_no',
                    'tabIndex' => 'f',
                    'customCode' =>
                    '
                    <div id="tst" style="display:none;"></div>
                    <input readonly="readonly" type="text" name="document_no" id="document_no" value=\'{$fields.document_no.value}\'>
                    <input type="hidden" name="number" id="number" value=\'{$fields.number.value}\'>
                    ',
                ),
                'assigned_user_name',
            ),
            array(
                'parent_name',
                'type',
            ),
            array(
                array(
                    'name' => 'parent_index_dbf',
                    'customCode' =>
                    '
                    <div name=\'parent_index_dbf\' id=\'parent_index_dbf\'></div>
                    ',
                ),
                array(
                    'name' => 'template_name',
                    'label' => 'LBL_TEMPLATE_NAME',
                    'customCode' =>
                    '
                    <select id="template_id" name="template_id" onChange="document.getElementById(\'template_name\').value=this.options[this.selectedIndex].text;">{$DOCUMENT_TEMPLATES_OPTIONS}</select>
                    <input type="hidden" id="template_name" name="template_name" value="{$fields.template_name.value}">
                    ',
                ),
            ),
            array(
                array(
                    'name' => 'register_date',
                    'type' => 'datetime',
                    'displayParams' => array(
                        'showFormats' => true,
                    ),
                ),
                //'ecmreceipt_name',
            ),
            array(
                array(
                    'name' => 'sell_date',
                    'type' => 'datetime',
                    'displayParams' => array(
                        'showFormats' => true,
                    ),
                ),
                array(
                    'label' => 'LBL_STOCK_NAME',
                    'name' => 'stock_id',
                    'customCode' =>
                    '
                    <select name="stock_id" id="stock_id">{$STOCK}</select>
                    ',
                ),
            ),
            array(
                array(
                    'name' => 'name',
                    'label' => 'LBL_NAME',
                ),
            ),
            array(
//                array(
//                    'name' => 'discount',
//                    'tabindex' => 'd',
//                    'customCode' =>
//                    '
//                    <input type="text" name="discount" id="discount" value="{$fields.discount.value}"  onChange="if(CheckDiscount() != -1) calculateTotal();" onKeyDown="return N.KeyPressed(event,this.parentNode,\'decimalNumber\');" >%
//                    ',
//                )
            ),
            array(
                array(
                    'name' => 'to_informations',
                    'allCols' => true,
                    'hideLabel' => true,
                    'customCode' =>
                    '
                    <div class="tabForm" style="border-top:none;width:100%;height:1px;padding:0px;align:center;"></div>
                    <h4>{$MOD.LBL_TO_PAYMENTS}</h4>
                    ',
                ),
            ),
            array(
                array(
                    'name' => 'to_paid',
                    'label' => 'LBL_TO_PAID',
                    'customCode' =>
                    '
                    <div id="to_paid"></div>
                    ',
                ),
                'payment_date_d',
            ),
            array(
                'prepaid',
                'payment_date',
            ),
            array(
                'prepaid_nr',
                'payment_method',
            ),
            array(
                'paid_val',
                'payment_method_paid',
            ),
            array(
                array(
                    'name' => 'left',
                    'label' => 'LBL_LEFT',
                    'customCode' =>
                    '
                    <div id="left"></div>
                    ',
                ),
            ),
            array(
                array(
                    'name' => 'to_informations',
                    'allCols' => true,
                    'hideLabel' => true,
                    'customCode' =>
                    '
                    <div class="tabForm" style="border-top:none;width:100%;height:1px;padding:0px;align:center;"></div>
                    <h4>{$MOD.LBL_TO_INFORMATIONS}</h4>
                    ',
                ),
            ),
            //
            array(
                array(
                    'name' => 'parent_name_copy',
                    'tabIndex' => '1',
                    'customCode' =>
                    '
                    <input type="text" name="parent_name_copy" id="parent_name_copy"  value="{$fields.parent_name.value}" size="30" />
                    ',
                ),
                array(
                    'name' => 'to_nip',
                    'tabIndex' => '1',
                ),
            ),
            array(
                array(
                    'name' => 'parent_contact_name',
                    'tabIndex' => '1',
                ),
                array(
                    'name' => 'currency_id',
                    'label' => 'LBL_CURRENCY',
                ),
            ),
            array(
                array(
                    'name' => 'parent_contact_title',
                    'tabIndex' => '1',
                ),
                array(
                    'name' => 'currency_value',
                    'label' => 'LBL_CURRENCY_VALUE',
                ),
            ),
            array(
                array(
                    'name' => 'parent_address_street',
                    'tabIndex' => '1',
                    'customCode' =>
                    '
                    <textarea tabindex="1" id="parent_address_street" name="parent_address_street" rows="2" cols="30" maxlength="150" >{$fields.parent_address_street.value}</textarea>
                    ',
                ),
                array(
                    'name' => 'pdf_type',
                    'label' => 'LBL_PDF_TYPE',
                ),
            ),
            array(
                array(
                    'name' => 'parent_address_city',
                    'tabIndex' => '1',
                    'customCode' =>
                    '
                    <input maxlength="8" type="text" name="parent_address_postalcode" id="parent_address_postalcode" value="{$fields.parent_address_postalcode.value}" style="vertical-align:top;width:80px;" />&nbsp;&nbsp;<input type="text" name="parent_address_city" id="parent_address_city" value="{$fields.parent_address_city.value}" style="vertical-align:top;width:150px;" />
                    ',
                ),
            ),
            array(
                array(
                    'name' => 'parent_address_country',
                    'tabIndex' => '1',
                ),
            ),
            array(
                array(
                    'name' => 'to_informations',
                    'allCols' => true,
                    'hideLabel' => true,
                    'customCode' =>
                    '
                    <div class="tabForm" style="border-top:none;width:100%;height:1px;padding:0px;align:center;"></div>
                    <h4>{$MOD.LBL_PARENT_SHIPPING_ADDRESS}</h4>
                    ',
                ),
            ),
            array(
                array(
                    'name' => 'address',
                    'customCode' =>
                    '
                    <div id=\'addresses\'></div>
                    ',
                ),
                '',
            ),
            
            array(
                'parent_shipping_address_name',
            ),
            array(
                'parent_shipping_address_street',
            ),
            array(
                array(
                    'name' => 'parent_shipping_address_city',
                    'tabIndex' => '1',
                    'customCode' =>
                    '
                    <input maxlength="8" type="text" name="parent_shipping_address_postalcode" id="parent_shipping_address_postalcode" value="{$fields.parent_shipping_address_postalcode.value}" style="vertical-align:top;width:80px;" />&nbsp;&nbsp;<input type="text" name="parent_shipping_address_city" id="parent_shipping_address_city" value="{$fields.parent_shipping_address_city.value}" style="vertical-align:top;width:150px;" />
                    ',
                ),
            ),
            array(
                'parent_shipping_address_country',
            ),
        ),
        'LBL_ITEMS_TAB' => array(
            array(
                array(
                    'name' => 'items_list_panel',
                    'allCols' => true,
                    'hideLabel' => true,
                    'customCode' =>
                    '
                    <link rel="stylesheet" type="text/css" href="modules/EcmReceipts/MyTable.css" />
                    <link rel="stylesheet" type="text/css" href="modules/EcmReceipts/AjaxSearch/AjaxSearch.css" />
                    <div style="width:100%;border: 1px solid rgb(48,192,255);background-color:white;height:{$OPT.position_table_height}px;max-height:{$OPT.position_table_height}px;overflow:auto;" id="itemsTableDIV">
                        <table class="positions" style="width:100%;" id="itemsTable">
                            <thead id="head">
                                <tr id="tr">
                                    <td width="3%">{$MOD.LBL_EDITTABLE_NO}</td>
                                    <td width="8%">{$MOD.LBL_EDITTABLE_CODE}</td>
                                    <td width="32%">{$MOD.LBL_EDITTABLE_NAME}</td>
                                    <td width="5%">{$MOD.LBL_EDITTABLE_QUANTITY}</td>
                                    <td width="15%">{$MOD.LBL_EDITTABLE_PRICE_SUB_EXT}</td>
                                    <td width="5%">{$MOD.LBL_EDITTABLE_DISCOUNT}</td>
                                    <td width="3%">{$MOD.LBL_EDITTABLE_VAT}</td>
                                    <td width="14%">{$MOD.LBL_EDITTABLE_PRICE_EXT}</td>
                                    <td width="4%">{$MOD.LBL_EDITTABLE_UNIT}</td>
                                    <td width="10%">{$MOD.LBL_EDITTABLE_TOTAL_EXT}</td>
                                    <td width="5%">{$MOD.LBL_EDITTABLE_STOCK}</td>
                                    <td width="5%">{$MOD.LBL_EDITTABLE_OPTIONS}</td>
                                </tr>
                            </thead>
                            <tbody id="tbody">
                            </tbody>
                        </table>
                    </div>
                    <table width="100%"" cellpadding="0" cellspacing="0" border="0">
                        <tr>
                            <td width="55%" class="dataLabel" valign="top">
                                <a href="javascript: N.moveUpRow();" >{$MOD.LBL_MOVE_ROW_UP}</a> - <a href="javascript: N.moveDownRow();" >{$MOD.LBL_MOVE_ROW_DOWN}</a>
                            </td>
                            <td width="40%" class="dataField" style="text-align: left;">
                            <br/>
                                <table  id="result_table" cellpadding="0" cellspacing="0" style="width:100%; height:100%; border: 1px solid rgb(48,192,255);">
                                    <tr id="subtotal_tr">
                                        <td class="positionsLabel" style="border-top:0px;">
                                            {$MOD.LBL_SUBTOTAL}
                                        </td>
                                        <td class="positionsField" style="border-top:0px;">
                                            <input type="text" style="border:0px;font-weight:900;width:100%;text-align:right;" readonly="readonly" name="subtotal" id="subtotal" value=\'{$fields.subtotal.value}\'>
                                        </td>
                                    </tr>
                                    <tr id="total_tr">
                                        <td class="positionsLabel">
                                            {$MOD.LBL_TOTAL}
                                        </td>
                                        <td class="positionsField">
                                            <input type="text" readonly="readonly" style="border:0px;font-weight:900;width:100%;text-align:right;" name="total" id="total" value=\'{$fields.total.value}\'>
                                        </td>
                                    </tr>
                                </table>
                            </td>
                            <td width="5%" class="dataField" style="text-align: left;">&nbsp;</td>
                        </tr>
                    </table>
                    ',
                ),
            ),
        ),
        'LBL_TEXTS_TAB' => array(
            array(
                array(
                    'name' => 'header_text',
                    'label' => 'LBL_HEADER_TEXT',
                    'customCode' =>
                    '
                    {$MFP.footer}
                    <br />
                    <textarea id="header_text" name="header_text" rows="5" style="width:100%;">
                        {$fields.header_text.value}
                    </textarea>
                    ',
                ),
            ),
            array(
                array(
                    'name' => 'footer_text',
                    'label' => 'LBL_FOOTER_TEXT',
                    'customCode' =>
                    '
                    {$MFP.header}
                    <br />
                    <textarea id="footer_text" name="footer_text" rows="5" style="width:100%;">
                        {$fields.footer_text.value}
                    </textarea>
                    ',
                ),
            ),
            array(
                array(
                    'name' => 'ads_text',
                    'label' => 'LBL_ADS_TEXT',
                    'customCode' =>
                    '
                    {$MFP.ads}
                    <br/>
                    <textarea id="ads_text" name="ads_text" rows="5" style="width:100%;">
                        {$fields.ads_text.value}
                    </textarea>
                    ',
                ),
            ),
        ),
    ),
);