<?php

/*********************************************************************************
 * 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".
 * *******************************************************************************/

  global $sugar_config;

$viewdefs['EcmStockDocIns']['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(this);" type="button" name="button" value="{$APP.LBL_SAVE_BUTTON_LABEL}">'),
          'CANCEL',
		  array('customCode' => '&nbsp;<input title="{$MOD.LBL_GO_TO_LIST_BUTTON_TITLE}" accessKey="{$MOD.LBL_GO_TO_LIST_BUTTON_KEY}" class="button" onclick="window.location=\'index.php?module=EcmStockDocIns&action=index\'" type="button" name="button" value="{$MOD.LBL_GO_TO_LIST_BUTTON_LABEL}">'),
       ),

        'hidden'=>array(
          '<input type="hidden" name="position_list" id="position_list" value=\'{$POSITION_LIST}\'>',
          '<input type="hidden" name="email_id" id="email_id" value=\'\'>',
		  '<input type="hidden" name="parent_type" id="parent_type" value="Accounts">',
		  '<input type="hidden" name="po_id" id="po_id" value="{$fields.po_id.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/EcmStockDocIns/AjaxSearch/AjaxSearch.js'),
      
      array('file'=>'modules/EcmStockDocIns/formloader.js'),
      
      array('file'=>'modules/EcmStockDocIns/MyTable.js'),

      array('file'=>'modules/EcmStockDocIns/EcmStockDocIns44.js'),
	  
	  array('file'=>'modules/EcmStockDocIns/CreateItem.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' => '1',
				'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}\'>'
			),
			array(
				'name' => 'assigned_user_name',
				'tabIndex' => '1'
			)
		),

		array (
			array(
				'name' => 'parent_name',
				'tabIndex' => '1',
			),
			array(
				'name' => 'template_name',
				'label'=>'LBL_TEMPLATE_NAME',
				'tabIndex' => '1',
				'customCode'=>'<select tabindex="1" 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 (
			'contact_name',
			array(
				'label'=>'LBL_STOCK_NAME',
				'tabIndex' => '1',
				'name'=>'stock_id',
				'customCode'=>'<select name="stock_id" id="stock_id">{$STOCK}</select>',
			),
		),
		array (
			array(
				'name' => 'name',
				'tabIndex' => '1',
			),
			array(
				'name' => 'kind',
				'tabIndex' => '1',
			),
		),  
		
		array (
			array(
				'name' => 'register_date',
				'tabIndex' => '1',
				'type' => 'datetime',
				'displayParams'=>array('showFormats'=>true)
			),
		),
		array('status'),
		array('payment_date','data_fk'),
		array('left_to_pay'),

      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}" readOnly="readonly" size="30" />'
        ),
		array(
			'name' => 'ecmlanguage',
			'tabIndex' => '1',
		)
	  ),
      array (
        array(
          'name' => 'parent_contact_name',
          'tabIndex' => '1',
        ),
	  ),
      array (
        array(
          'name' => 'parent_contact_title',
          'tabIndex' => '1',
        ),
	  ),

      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'=>'show_images_on_offers',
		  'tabindex'=>'1',
		  'customCode'=>'<input type="checkbox" id="show_images_on_offers" name="show_images_on_offers" value="1" {$CHECKBOX_SHOW_IMAGES_ON_OFFERS}>',
		 ),
		 */
      ),
	
	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' => '
		  <script>
								{literal}
								function hideElementsByClassName(cn){
									var arr = new Array(); 
									var els = document.getElementsByTagName("*");
									var exp= new RegExp("^(.* )?"+cn+"( .*)?$", "g");
									for (var i = 0; i < els.length; i++ ){
										if (exp.test(els[i].className)){
											els[i].style.display="none";
										}
									}
								}
								function showElementsByClassName(cn){
									var arr = new Array(); 
									var els = document.getElementsByTagName("*");
									var exp= new RegExp("^(.* )?"+cn+"( .*)?$", "g");
									for (var i = 0; i < els.length; i++ ){
										if (exp.test(els[i].className)){
											els[i].style.display="block";
										}
									}
								}
								function select_kind(value)
								{
									document.getElementById("import_title").style.display="none";
									document.getElementById("import_table").style.display="none";
									
									hideElementsByClassName("items_import_div");
									hideElementsByClassName("items_country_div");
	
									if (value=="import") {
										document.getElementById("import_title").style.display="block";
										document.getElementById("import_table").style.display="block";
										showElementsByClassName("items_import_div");	
									}
								}
								{/literal}
		</script>
		  <div class="tabForm" id="import_title" style="border-top:none;width:100%;height:1px;padding:0px;align:center;{$IMPORT}"><h4 style="padding-top: 5px;">Import</h4></div>
		  '
        ),
      ), 
	 array(
	 	array(
			'name'=>'pz_options',
			'hideLabel'=>true,
			'customCode'=>'
			<div id="import_table" style="{$IMPORT}"><br>{$IMPORT_TABLE}</div>
			',
		),
	),
    
	),

    

    'LBL_ITEMS_TAB'=> array(

      array(

        array(
		  'name' => 'items_list_panel',
          'allCols' => true,

          'hideLabel' => true,

          'customCode' => '

          '

//          .'{literal}'.

//          '<script language="javascript">var parent_options='.$json->encode($app_list_strings['ecmworkitems_parent_dom']).';</script>'

//          .'{/literal}'.

          .'

          <link rel="stylesheet" type="text/css" href="modules/EcmStockDocIns/MyTable.css" />
          <link rel="stylesheet" type="text/css" href="modules/EcmStockDocIns/AjaxSearch/AjaxSearch.css" />
			<br><input type="button" name="button" class="button" value="{$MOD.BTN_CALCULATE_PURCHASE_PRICE}" onClick="calculatePrices();"/><br>
          <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="4%">{$MOD.LBL_EDITTABLE_NO}</td>

                  <td width="10%">{$MOD.LBL_EDITTABLE_CODE}</td>

                  <td width="45%">{$MOD.LBL_EDITTABLE_NAME}</td>

                  <td width="5%">{$MOD.LBL_EDITTABLE_QUANTITY}</td>
                  <td width="3%">{$MOD.LBL_EDITTABLE_UNIT}</td>
 				  <td width="8%">Ostatnia cena</td>
                  <td width="8%">{$MOD.LBL_EDITTABLE_INVOICE_PRICE}</td>

                  <td width="12%">{$MOD.LBL_EDITTABLE_PRICE}</td>

                  <td width="6%">{$MOD.LBL_EDITTABLE_VAT}</td>

                  <td width="12%">{$MOD.LBL_EDITTABLE_TOTAL}</td>
                  <td width="12%">{$MOD.LBL_EDITTABLE_WEIGHT_NETTO}</td>

                  <td width="12%">{$MOD.LBL_EDITTABLE_ADD_FIELDS}</td>
				  <td width="12%">Nr parti</td>
				 <td width="12%">Data ważności</td>

                  <td width="6%">{$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>                                                                               <!--color:#b3b9cf;-->

                <td width="40%" class="dataField" style="text-align: left;">

                <br>

             <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>                                                                               <!--color:#b3b9cf;-->

                <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_2" id="total_2" value=\'\'></td>

                </tr>
<!--
                <tr id="discount_tr"> 

                  <td class="positionsLabel">{$MOD.LBL_DISCOUNT}</td>

                  <td class="positionsField"><input type="text" readonly="readonly" style="border:0px;font-weight:900;width:100%;text-align:right;" name="discount_2" id="discount_2" 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>'),),

    ),


/*
    'LBL_PREVIEW_TAB'=> array(

      array(

        array(
			
          'name' => 'preview_panel',

          'allCols' => true,

          'hideLabel' => true,

          'customCode' => '<span id=\'previewPDF\' width="100%" height="100%"></span>'

        ),

      ),


    ),

*/

	),	



);











?>



