<?php
/**
 * The receive view file of contract module of ZDOO.
 *
 * @copyright   Copyright 2009-2018 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
 * @license     ZPL (http://zpl.pub/page/zplv12.html)
 * @author      Gang Liu <liugang@cnezsoft.com>
 * @package     contract
 * @version     $Id$
 * @link        http://www.zdoo.com
 */
?>
<?php include '../../../sys/common/view/header.modal.html.php';?>
<?php include '../../../sys/common/view/editor.html.php';?>
<form method='post' id='receiveForm' class='form-table' action='<?php echo inlink('receive', "contractID={$contract->id}")?>'>
  <table class='table table-form table-condensed'>
    <tr>
      <th class='w-60px'><?php echo $lang->$moduleType->all;?></th>
      <td><?php echo zget($currencySign, $contract->currency, $contract->currency) . $contract->amount;?></td>
    </tr>
    <tr>
      <th><?php echo $lang->$moduleType->thisAmount;?></th>
      <td>
        <div class='input-group'>
          <?php echo html::input('amount', '', "class='form-control'");?>
          <div class='input-group-addon'>
            <label class='checkbox-inline'><input type='checkbox' id='finish' name='finish' value='1'> <?php echo $lang->$moduleType->completeReturn;?></label>
          </div>
          <div class='input-group-addon'>
            <label class='checkbox-inline'><input type='checkbox' id='createTrade' name='createTrade' value='1' checked='checked'> <?php echo $lang->trade->create;?></label>
          </div>
        </div>
      </td>
    </tr>
    <tr class='tradeTR'>
      <th><?php echo $lang->trade->depositor;?></th>
      <td><?php echo html::select('depositor', $depositorList, '', "class='form-control'");?></td>
    </tr>
    <tr class='tradeTR'>
      <th><?php echo $lang->trade->category;?></th>
      <td><?php echo html::select('category', array('') + (array) $categories, '', "class='form-control'");?></td>
    </tr>
    <tr class='tradeTR'>
      <th><?php echo $lang->trade->dept;?></th>
      <td><?php echo html::select('dept', array('') + (array) $deptList, isset($dept->id) ? $dept->id : '', "class='form-control'");?></td>
    </tr>
    <tr class='tradeTR'>
      <th><?php echo $lang->trade->product;?></th>
      <td><?php echo html::select('product', $productList, $product, "class='form-control chosen'");?></td>
    </tr>
    <tr>
      <th><?php echo $lang->$moduleType->returnedBy;?></th>
      <td><?php echo html::select('returnedBy', $users, $this->app->user->account, "class='form-control chosen'");?></td>
    </tr>
    <tr>
      <th><?php echo $lang->$moduleType->returnedDate;?></th>
      <td><?php echo html::input('returnedDate', '', "class='form-control form-date'");?></td>
    </tr>
    <tr>
      <th><?php echo $lang->trade->handlers;?></th>
      <td><?php echo html::select('handlers[]', $users, $contract->handlers . ',' . $this->app->user->account, "class='form-control chosen' multiple");?></td>
    </tr>
    <tr>
      <th><?php echo $lang->comment;?></th>
      <td><?php echo html::textarea('comment', '', "rows='2'");?></td>
    </tr>
    <tr>
      <th></th>
      <td>
        <div id='duplicateError' class='alert alert-danger duplicate hide'></div>
        <?php echo html::submitButton();?>
        <?php echo html::commonButton($lang->contract->updateTrade, 'btn btn-warning duplicate hide', "id='updateTrade'");?>
        <?php echo html::commonButton($lang->continueSave, 'btn btn-warning duplicate hide', "id='continueSubmit'");?>
      </td>
    </tr>
  </table>
</form>
<?php if(!empty($contract->returnList)):?>
<div class='panel'>
  <div class='panel-heading'><strong><?php echo $lang->$moduleType->returnRecords;?></strong></div>
  <div class='panel-body'>
    <?php foreach($contract->returnList as $return):?>
    <?php printf($lang->$moduleType->returnInfo, formatTime($return->returnedDate, DT_DATE1), zget($users, $return->returnedBy, $return->returnedBy), zget($currencySign, $contract->currency, '') . $return->amount);?>
    <?php endforeach;?>
  </div>
</div>
<?php endif;?>
<?php include '../../../sys/common/view/footer.modal.html.php';?>
