/**
  * Renders task creation form
  * 
  * @return string
  */
 public function renderCreateForm($login)
 {
     $result = '';
     $result .= wf_AjaxLoader();
     $inputs = wf_HiddenInput('newschedlogin', $login);
     $inputs .= wf_DatePickerPreset('newscheddate', curdate()) . ' ' . __('Target date') . wf_tag('br');
     $inputs .= wf_AjaxSelectorAC('ajparamcontainer', $this->actions, __('Task'), '', true);
     $inputs .= wf_AjaxContainer('ajparamcontainer');
     $result .= wf_Form('', 'POST', $inputs, 'glamour');
     return $result;
 }
Exemple #2
0
 /**
  * Renders debtors notifications by address selection
  * 
  * 
  * @return void
  */
 public function reportDebtStreets()
 {
     if (wf_CheckGet(array('aj_rdabuildsel'))) {
         if (!empty($_GET['aj_rdabuildsel'])) {
             $streetId = base64_decode($_GET['aj_rdabuildsel']);
             $buildInputs = wf_HiddenInput('streetsel', $streetId);
             $buildInputs .= wf_TextInput('debtcash', __('The threshold at which the money considered user debtor'), '0', true, 4);
             $buildInputs .= wf_Submit(__('Print'));
             die($buildInputs);
         } else {
             die('');
         }
     }
     if (!wf_CheckPost(array('streetsel'))) {
         $streetData = array();
         if (!empty($this->streets)) {
             foreach ($this->streets as $streetId => $eachStreetName) {
                 $streetId = base64_encode($eachStreetName);
                 $streetData[self::URL_REPORTS_MGMT . 'reportDebtStreets' . '&aj_rdabuildsel=' . $streetId] = $eachStreetName;
             }
         }
         $inputs = wf_AjaxLoader();
         $inputs .= wf_AjaxSelectorAC('aj_buildcontainer', $streetData, __('Street'), '', false);
         $inputs .= wf_AjaxContainer('aj_buildcontainer');
         $form = wf_Form('', 'POST', $inputs, 'glamour');
         show_window(__('Current debtors for delivery by streets'), $form);
     } else {
         $searchStreet = mysql_real_escape_string($_POST['streetsel']);
         $debtCash = wf_CheckPost(array('debtcash')) ? '-' . vf($_POST['debtcash'], 3) : 0;
         $query = "SELECT * from `ukv_users` WHERE `cash`<'" . $debtCash . "' AND `street`='" . $searchStreet . "'  AND `active`='1' ORDER BY `build`";
         $allDebtors = simple_queryall($query);
         $rawTemplate = file_get_contents(CONFIG_PATH . "catv_debtors.tpl");
         $printableTemplate = '';
         if (!empty($allDebtors)) {
             foreach ($allDebtors as $io => $each) {
                 $rowtemplate = $rawTemplate;
                 $rowtemplate = str_ireplace('{REALNAME}', $each['realname'], $rowtemplate);
                 $rowtemplate = str_ireplace('{STREET}', $each['street'], $rowtemplate);
                 $rowtemplate = str_ireplace('{BUILD}', $each['build'], $rowtemplate);
                 $rowtemplate = str_ireplace('{APT}', $each['apt'], $rowtemplate);
                 $rowtemplate = str_ireplace('{DEBT}', $each['cash'], $rowtemplate);
                 $rowtemplate = str_ireplace('{CURDATE}', curdate(), $rowtemplate);
                 $rowtemplate = str_ireplace('{PAYDAY}', date("Y-m-") . '01', $rowtemplate);
                 $printableTemplate .= $rowtemplate;
             }
             $printableTemplate = wf_TableBody($printableTemplate, '100%', 0, 'sortable');
             $printableTemplate = $this->reportPrintable(__('Current debtors for delivery by streets'), $printableTemplate);
         } else {
             show_window('', $this->messages->getStyledMessage(__('Nothing found'), 'info'));
         }
     }
 }
 /**
  * Returns outcoming operation creation form
  * 
  * @param int $storageid
  * @param int $itemtypeid
  * 
  * @return string
  */
 public function outcomingCreateForm($storageid, $itemtypeid)
 {
     $result = '';
     $storageid = vf($storageid, 3);
     $itemtypeid = vf($itemtypeid, 3);
     $tmpDests = array();
     if (isset($this->allStorages[$storageid]) and isset($this->allItemTypes[$itemtypeid])) {
         $itemData = $this->allItemTypes[$itemtypeid];
         $itemUnit = $this->unitTypes[$itemData['unit']];
         $storageRemains = $this->remainsOnStorage($storageid);
         $allRemains = $this->remainsAll();
         if (isset($storageRemains[$itemtypeid])) {
             $itemRemainsStorage = $storageRemains[$itemtypeid];
         } else {
             $itemRemainsStorage = 0;
         }
         if (isset($allRemains[$itemtypeid])) {
             $itemRemainsTotal = $allRemains[$itemtypeid];
         } else {
             $itemRemainsTotal = 0;
         }
         $isReserved = $this->reserveGet($storageid, $itemtypeid);
         foreach ($this->outDests as $destMark => $destName) {
             $tmpDests[self::URL_ME . '&' . self::URL_OUT . '&' . self::URL_AJODSELECTOR . $destMark] = $destName;
         }
         //form construct
         $inputs = wf_AjaxLoader();
         $inputs .= wf_HiddenInput('newoutdate', curdate());
         $inputs .= wf_AjaxSelectorAC('ajoutdestselcontainer', $tmpDests, __('Destination'), '', false);
         $inputs .= wf_AjaxContainer('ajoutdestselcontainer', '', $this->outcomindAjaxDestSelector('task'));
         $inputs .= wf_HiddenInput('newoutitemtypeid', $itemtypeid);
         $inputs .= wf_HiddenInput('newoutstorageid', $storageid);
         $inputs .= wf_TextInput('newoutcount', $itemUnit . ' (' . ($itemRemainsStorage - $isReserved) . ' ' . __('maximum') . ')', '', true, '4');
         $inputs .= wf_TextInput('newoutprice', __('Price') . ' (' . __('middle price') . ': ' . $this->getIncomeMiddlePrice($itemtypeid) . ')', '', true, '4');
         $inputs .= wf_TextInput('newoutnotes', __('Notes'), '', true, 25);
         $inputs .= wf_tag('br');
         $inputs .= wf_Submit(__('Create'));
         $form = wf_Form('', 'POST', $inputs, 'glamour');
         //notifications
         if ($itemRemainsTotal < $itemData['reserve']) {
             $remainsAlert = __('The balance of goods and materials in stock is less than the amount') . ' ' . $itemData['reserve'] . ' ' . $itemUnit;
         } else {
             $remainsAlert = '';
         }
         $remainsNotification = __('At storage') . ' ' . @$this->allStorages[$storageid] . ' ' . __('remains') . ' ' . $itemRemainsStorage . ' ' . $itemUnit . ' ' . $itemData['name'];
         $notifications = $this->messages->getStyledMessage($remainsNotification, 'success');
         if ($isReserved) {
             $notifications .= $this->messages->getStyledMessage(__('Reserved') . ' ' . $isReserved . ' ' . $itemUnit, 'info');
         }
         if ($remainsAlert) {
             $notifications .= $this->messages->getStyledMessage($remainsAlert, 'warning');
         }
         $notifications .= wf_CleanDiv();
         if (cfr('WAREHOUSERESERVE')) {
             $reserveLink = self::URL_ME . '&' . self::URL_RESERVE . '&itemtypeid=' . $itemtypeid . '&storageid=' . $storageid;
             $notifications .= wf_tag('div', false, '', 'style="margin: 20px 3% 0 3%;"') . wf_Link($reserveLink, wf_img('skins/whreservation.png') . ' ' . __('Reservation'), false, 'ubButton') . wf_tag('div', true);
             $notifications .= wf_CleanDiv();
         }
         $cells = wf_TableCell($form, '40%');
         $cells .= wf_TableCell($notifications, '', '', 'valign="top"');
         $rows = wf_TableRow($cells);
         $result = wf_TableBody($rows, '100%', 0, '');
         //photostorage integration
         if ($this->altCfg['PHOTOSTORAGE_ENABLED']) {
             $photostorage = new PhotoStorage(self::PHOTOSTORAGE_SCOPE, $itemtypeid);
             $result .= $photostorage->renderImagesRaw();
         }
     } else {
         $result = $this->messages->getStyledMessage(__('Strange exeption'), 'error');
     }
     return $result;
 }
Exemple #4
0
 /**
  * Renders service and IP selection dialog 
  * 
  * @return string
  */
 public function renderMainForm()
 {
     $result = '';
     $servSelector = array();
     if (!empty($this->allServices)) {
         foreach ($this->allServices as $serviceId => $serviceName) {
             $servSelector[self::URL_ME . '&ajserviceid=' . $serviceId] = $serviceName;
         }
         //getting firs service ID
         reset($this->allServices);
         $defaultService = key($this->allServices);
         $result = wf_AjaxLoader();
         $inputs = wf_AjaxSelectorAC('ajcontainer', $servSelector, __('Select User new service'), '', false);
         $inputs .= wf_tag('br') . wf_tag('br');
         $inputs .= wf_AjaxContainer('ajcontainer', '', $this->ajIpSelector($defaultService));
         $inputs .= wf_delimiter();
         $inputs .= wf_Submit(__('Save'));
         $result .= wf_Form("", 'POST', $inputs, 'floatpanels');
     } else {
         $result = $this->messages->getStyledMessage(__('No available services'), 'error');
     }
     return $result;
 }