Example #1
0
File: edit.php Project: apexJCL/mvc
 /**
  * This method manages the update management, where it is update, delete or create a new book/author/editorial/genre
  */
 public function update()
 {
     $model = new Management();
     switch ($_GET['subaction']) {
         case 'add':
             $model->add();
             break;
         case 'update':
             $model->update();
             break;
         case 'delete':
             $model->delete();
             break;
     }
     switch ($_GET['type']) {
         // This is only for redirect purposes
         case 'book':
             header('Location: index.php?action=manage&type=books');
             break;
         case 'author':
             header('Location: index.php?action=manage&type=authors');
             break;
         case 'editorial':
             header('Location: index.php?action=manage&type=editorials');
             break;
         case 'genre':
             header('Location: index.php?action=manage&type=genres');
             break;
         case 'reader':
             header('Location: index.php?action=manage&type=readers');
             break;
     }
 }
function get_receipt_data_from_server()
{
    $manager = new Management();
    $data = $manager->get_list_of_product_info();
    $receipt = new Receipt();
    $receipt->get_data_from_array($data);
    return $receipt;
}
function get_import_product_data_from_server($query)
{
    $manager = new Management();
    $data = $manager->get_list_of_import_product_info($query);
    if (!isset($data['error'])) {
        $list = new Receipt();
        $list->get_data_from_array($data);
        return $list;
    } else {
        return $data;
    }
}
 /**
  * @return bool|TblPerson
  */
 public function getServiceManagementPerson()
 {
     if (null === $this->serviceManagement_Person) {
         return false;
     } else {
         return Management::servicePerson()->entityPersonById($this->serviceManagement_Person);
     }
 }
Example #5
0
 public function testGetTaxClassIdByNameType()
 {
     $taxClassKey = $this->getMock('\\Magento\\Tax\\Api\\Data\\TaxClassKeyInterface');
     $taxClassKey->expects($this->once())->method('getType')->willReturn(\Magento\Tax\Api\Data\TaxClassKeyInterface::TYPE_NAME);
     $taxClassKey->expects($this->once())->method('getValue')->willReturn('value');
     $this->filterBuilder->expects($this->exactly(2))->method('setField')->with($this->logicalOr(\Magento\Tax\Api\Data\TaxClassInterface::KEY_TYPE, \Magento\Tax\Api\Data\TaxClassInterface::KEY_NAME))->willReturnSelf();
     $this->filterBuilder->expects($this->exactly(2))->method('setValue')->with($this->logicalOr('PRODUCT', 'value'))->willReturnSelf();
     $filter = $this->getMock('\\Magento\\Framework\\Api\\Filter', [], [], '', false);
     $this->filterBuilder->expects($this->exactly(2))->method('create')->willReturn($filter);
     $this->searchCriteriaBuilder->expects($this->exactly(2))->method('addFilter')->with([$filter])->willReturnSelf();
     $searchCriteria = $this->getMock('\\Magento\\Framework\\Api\\SearchCriteriaInterface');
     $this->searchCriteriaBuilder->expects($this->once())->method('create')->willReturn($searchCriteria);
     $result = $this->getMock('\\Magento\\Tax\\Api\\Data\\TaxRateSearchResultsInterface');
     $result->expects($this->once())->method('getItems')->willReturn([]);
     $this->classRepository->expects($this->once())->method('getList')->with($searchCriteria)->willReturn($result);
     $this->assertNull($this->model->getTaxClassId($taxClassKey), 'PRODUCT');
 }
Example #6
0
 public function showManagement()
 {
     $controller = new Management();
     switch ($_GET['type']) {
         case 'authors':
             $rows = $controller->getAutorsData();
             include 'view/management/authors.php';
             break;
         case 'books':
             $rows = $controller->getBooksData();
             include 'view/management/books.php';
             break;
         case 'editorials':
             $rows = $controller->getEditorialsData();
             include 'view/management/editorials.php';
             break;
         case 'genres':
             $rows = $controller->getGenres();
             include 'view/management/genres.php';
             break;
         case 'readers':
             $rows = $controller->getUsers();
             include 'view/management/users.php';
             break;
         case 'statistics':
             $data = $controller->getStatistics();
             include 'view/management/statistics.php';
             break;
     }
 }
 /**
  * @return bool|TblStudent
  */
 public function getServiceManagementStudent()
 {
     if (null === $this->serviceManagement_Student) {
         return false;
     } else {
         return Management::serviceStudent()->entityStudentByNumber($this->serviceManagement_Student);
         //todo
     }
 }
 /**
  * Authenticates a user.
  * @return boolean whether authentication succeeds.
  */
 public function authenticate()
 {
     if ($this->user_type == 1 || $this->user_type == 2) {
         $criteria = new CDbCriteria();
         $criteria->condition = 'LOWER(mid)=' . strtolower($this->username) . ' AND management_user_level_id=' . $this->user_type;
         $user = Management::model()->find($criteria);
     } else {
         if ($this->user_type == 4) {
             $user = Doctor::model()->find('LOWER(did)=?', array(strtolower($this->username)));
         } else {
             if ($this->user_type == 3) {
                 $user = Patient::model()->find('LOWER(pid)=?', array(strtolower($this->username)));
             } else {
                 $user = Nurses::model()->find('LOWER(nid)=?', array(strtolower($this->username)));
             }
         }
     }
     if ($user === null) {
         $this->errorCode = self::ERROR_USERNAME_INVALID;
     } else {
         if (!($user->pass == $this->password)) {
             $this->errorCode = self::ERROR_PASSWORD_INVALID;
         } else {
             if ($this->user_type == 1 || $this->user_type == 2) {
                 $this->_id = $user->mid;
                 $this->username = $user->mid;
             } else {
                 if ($this->user_type == 4) {
                     $this->_id = $user->did;
                     $this->username = $user->did;
                 } else {
                     if ($this->user_type == 3) {
                         $this->_id = $user->pid;
                         $this->username = $user->pid;
                     } else {
                         $this->_id = $user->nid;
                         $this->username = $user->nid;
                     }
                 }
             }
             $this->_type = $this->user_type;
             $this->errorCode = self::ERROR_NONE;
             $this->setState("type", $this->_type);
         }
     }
     return $this->errorCode == self::ERROR_NONE;
 }
Example #9
0
 /**
  * @param $Id
  * @param $AddressId
  *
  * @return Stage
  */
 public function frontendInvoiceAddressChange($Id, $AddressId)
 {
     $Stage = new Stage();
     $Stage->setTitle('Rechnung');
     $Stage->setDescription('Rechnungsadresse Ändern');
     $tblInvoice = Invoice::useService()->entityInvoiceById($Id);
     $tblAddress = Management::serviceAddress()->entityAddressById($AddressId);
     $Stage->setContent(Invoice::useService()->executeChangeInvoiceAddress($tblInvoice, $tblAddress));
     return $Stage;
 }
<?php

session_start();
require_once $_SERVER["DOCUMENT_ROOT"] . 'Tam-An-Food-Store-Manager/' . 'config.php';
require_once CLASS_PATH . "Management.php";
//check if POST contain any login info of user
$arr = array();
$arr['message'] = "";
if (isset($_POST['username']) && isset($_POST['password'])) {
    $manage = new Management();
    //if yes check the login with the database, get user data on success
    //else return nothing
    $user_data = $manage->check_user_login($_POST['username'], $_POST['password']);
    //if user data has nothing
    if (!isset($user_data)) {
        //show err
        $arr['message'] = "Tên đăng nhập hoặc mật khẩu không hợp lệ.";
    } else {
        //otherwise, remember the login of user
        $_SESSION['is_login'] = true;
        $_SESSION['username'] = $user_data['Name'];
        $_SESSION['user_id'] = $user_data['Id'];
        $_SESSION['user_type'] = $user_data['User_type'];
    }
}
echo json_encode($arr);
Example #11
0
 /**
  * @return bool|TblChildRank
  */
 public function getServiceManagementStudentChildRank()
 {
     if (null === $this->serviceManagement_Student_ChildRank) {
         return false;
     } else {
         return Management::serviceStudent()->entityChildRankById($this->serviceManagement_Student_ChildRank);
         // todo
     }
 }
 /**
  * @param IFormInterface $Stage
  * @param                $Debtor
  * @param                $Id
  *
  * @return IFormInterface|string
  */
 public function executeAddDebtor(IFormInterface &$Stage = null, $Debtor, $Id)
 {
     /**
      * Skip to Frontend
      */
     if (null === $Debtor) {
         return $Stage;
     }
     $Error = false;
     if (isset($Debtor['DebtorNumber']) && empty($Debtor['DebtorNumber'])) {
         $Stage->setError('Debtor[DebtorNumber]', 'Bitte geben sie die Debitorennummer an');
         $Error = true;
     }
     if (isset($Debtor['DebtorNumber']) && Banking::useService()->entityDebtorByDebtorNumber($Debtor['DebtorNumber'])) {
         $Stage->setError('Debtor[DebtorNumber]', 'Die Debitorennummer exisitiert bereits. Bitte geben Sie eine andere Debitorennummer an');
         $Error = true;
     }
     if (isset($Debtor['LeadTimeFirst']) && empty($Debtor['LeadTimeFirst'])) {
         $Stage->setError('Debtor[LeadTimeFirst]', 'Bitte geben sie den Ersteinzug an.');
         $Error = true;
     }
     if (isset($Debtor['LeadTimeFirst']) && !is_numeric($Debtor['LeadTimeFirst'])) {
         $Stage->setError('Debtor[LeadTimeFirst]', 'Bitte geben sie eine Zahl an.');
         $Error = true;
     }
     if (isset($Debtor['LeadTimeFollow']) && empty($Debtor['LeadTimeFollow'])) {
         $Stage->setError('Debtor[LeadTimeFollow]', 'Bitte geben sie den Folgeeinzug an.');
         $Error = true;
     }
     if (isset($Debtor['LeadTimeFollow']) && !is_numeric($Debtor['LeadTimeFollow'])) {
         $Stage->setError('Debtor[LeadTimeFollow]', 'Bitte geben sie eine Zahl an.');
         $Error = true;
     }
     if (isset($Debtor['Reference']) && Banking::useService()->entityReferenceByReference($Debtor['Reference'])) {
         $Stage->setError('Debtor[Reference]', 'Die Mandatsreferenz exisitiert bereits. Bitte geben Sie eine andere an');
         $Error = true;
     }
     if (!$Error) {
         (new Data($this->Binding))->actionAddDebtor($Debtor['DebtorNumber'], $Debtor['LeadTimeFirst'], $Debtor['LeadTimeFollow'], $Debtor['BankName'], $Debtor['Owner'], $Debtor['CashSign'], $Debtor['IBAN'], $Debtor['BIC'], $Debtor['Description'], $Debtor['PaymentType'], Management::servicePerson()->entityPersonById($Id));
         //todo
         if (!empty($Debtor['Reference'])) {
             (new Data($this->Binding))->actionAddReference($Debtor['Reference'], $Debtor['DebtorNumber'], $Debtor['ReferenceDate'], Commodity::useService()->entityCommodityById($Debtor['Commodity']));
         }
         return new Success('Der Debitor ist erfasst worden') . new Redirect('/Billing/Accounting/Banking', 2);
     }
     return $Stage;
 }
 public function actionViewManagement()
 {
     $this->authenUser();
     $this->authenManagement();
     $managementId;
     $managementData;
     if (isset($_REQUEST['managementId'])) {
         $managementId = $_REQUEST['managementId'];
         if (!is_numeric($managementId)) {
             $this->redirect($statusCode = 404);
         } else {
             $managementData = Management::model()->find('mid=?', array($managementId));
             if ($managementData == null) {
                 $this->redirect($statusCode = 404);
             }
             // invalid request redirected to 404 not found page
         }
     }
     $this->render('viewManagement', array('managementProfile' => $managementData));
 }
Example #14
0
		/**
		 * Returns a menu-object with the menu corresponding to the path
		 * @param string Path to query for a new menu-object. format "/page1/page2/page3"
		 */
		function getMenuByPath($path="/") {
			$liste = explode("/", strtoupper($path));
			if ($path == "/" || $path=="") {
				$management = new Management($this);
				$page = $management->getStartPage($this->variation);	
			} else {
				if ($this->level != 0) {
			    	$page = getDBCell("state_translation", "OUT_ID", "IN_ID=0 AND LEVEL=".$this->level);
		    	} else {
				    $page = 0;
			    }
			
		    	for ($i = 1; $i < count($liste); $i++) {
			    	if ($page == "")
				    	$page = 0;

			    	if ($liste[$i] != "") 
				    	$page = getDBCell("sitemap", "MENU_ID", "PARENT_ID=$page AND UPPER(NAME)='" . $liste[$i] . "'");
				    }   
			    if ($page != "") 
				    $page = getDBCell("sitepage", "SPID", "MENU_ID=$page AND DELETED=0");
			}
	
		    if ($page == "") $page = getDBCell("state_translation", "OUT_ID", "IN_ID=0 AND LEVEL=".$this->level);	
		    return $this->createInstance(null, $page, $this->variation, $this->level);		
		}
Example #15
0
 /**
  * @param TblBasket $tblBasket
  * @param           $Date
  *
  * @return bool
  */
 public function actionCreateInvoiceListFromBasket(TblBasket $tblBasket, $Date)
 {
     $Manager = $this->Connection->getEntityManager();
     $tblTempInvoiceList = $this->entityTempInvoiceAllByBasket($tblBasket);
     /**@var TblTempInvoice $tblTempInvoice */
     foreach ($tblTempInvoiceList as $tblTempInvoice) {
         $tblDebtor = $tblTempInvoice->getServiceBillingDebtor();
         $tblPersonDebtor = Management::servicePerson()->entityPersonById($tblDebtor->getServiceManagementPerson());
         $tblPerson = $tblTempInvoice->getServiceManagementPerson();
         $Entity = new TblInvoice();
         $Entity->setIsPaid(false);
         $Entity->setIsVoid(false);
         $Entity->setNumber("40000000");
         $Entity->setBasketName($tblBasket->getName());
         $Entity->setServiceBillingBankingPaymentType($tblDebtor->getPaymentType());
         $leadTimeByDebtor = Banking::useService()->entityLeadTimeByDebtor($tblDebtor);
         $invoiceDate = (new \DateTime($Date))->sub(new \DateInterval('P' . $leadTimeByDebtor . 'D'));
         $now = new \DateTime();
         if ($invoiceDate->format('y.m.d') >= $now->format('y.m.d')) {
             $Entity->setInvoiceDate($invoiceDate);
             $Entity->setPaymentDate(new \DateTime($Date));
             $Entity->setIsPaymentDateModified(false);
         } else {
             $Entity->setInvoiceDate(new \DateTime('now'));
             $Entity->setPaymentDate($now->add(new \DateInterval('P' . $leadTimeByDebtor . 'D')));
             $Entity->setIsPaymentDateModified(true);
         }
         $Entity->setDiscount(0);
         $Entity->setDebtorFirstName($tblPersonDebtor->getFirstName());
         $Entity->setDebtorLastName($tblPersonDebtor->getLastName());
         $Entity->setDebtorSalutation($tblPersonDebtor->getTblPersonSalutation()->getName());
         $Entity->setDebtorNumber($tblDebtor->getDebtorNumber());
         $Entity->setServiceManagementPerson($tblPerson);
         if ($address = Management::servicePerson()->entityAddressAllByPerson($tblPersonDebtor)) {
             // TODO address type invoice
             $Entity->setServiceManagementAddress($address[0]);
         }
         $Manager->saveEntity($Entity);
         $Entity->setNumber((int) $Entity->getNumber() + $Entity->getId());
         $Manager->saveEntity($Entity);
         Protocol::useService()->createInsertEntry($this->Connection->getDatabase(), $Entity);
         $tblTempInvoiceCommodityList = $this->entityTempInvoiceCommodityAllByTempInvoice($tblTempInvoice);
         foreach ($tblTempInvoiceCommodityList as $tblTempInvoiceCommodity) {
             $tblCommodity = $tblTempInvoiceCommodity->getServiceBillingCommodity();
             $tblBasketItemAllByBasketAndCommodity = Basket::useService()->entityBasketItemAllByBasketAndCommodity($tblBasket, $tblCommodity);
             /**@var TblBasketItem $tblBasketItem */
             foreach ($tblBasketItemAllByBasketAndCommodity as $tblBasketItem) {
                 $tblItem = $tblBasketItem->getServiceBillingCommodityItem()->getTblItem();
                 if (!$tblItem->getServiceManagementCourse() && !$tblItem->getServiceManagementStudentChildRank()) {
                     $this->actionCreateInvoiceItem($tblCommodity, $tblItem, $tblBasket, $tblBasketItem, $Entity);
                 } else {
                     if ($tblItem->getServiceManagementCourse() && !$tblItem->getServiceManagementStudentChildRank()) {
                         if (($tblStudent = Management::serviceStudent()->entityStudentByPerson($tblPerson)) && $tblItem->getServiceManagementCourse()->getId() == $tblStudent->getServiceManagementCourse()->getId()) {
                             $this->actionCreateInvoiceItem($tblCommodity, $tblItem, $tblBasket, $tblBasketItem, $Entity);
                         }
                     } else {
                         if (!$tblItem->getServiceManagementCourse() && $tblItem->getServiceManagementStudentChildRank()) {
                             if (($tblStudent = Management::serviceStudent()->entityStudentByPerson($tblPerson)) && $tblItem->getServiceManagementStudentChildRank()->getId() == $tblStudent->getTblChildRank()->getId()) {
                                 $this->actionCreateInvoiceItem($tblCommodity, $tblItem, $tblBasket, $tblBasketItem, $Entity);
                             }
                         } else {
                             if ($tblItem->getServiceManagementCourse() && $tblItem->getServiceManagementStudentChildRank()) {
                                 if (($tblStudent = Management::serviceStudent()->entityStudentByPerson($tblPerson)) && $tblItem->getServiceManagementCourse()->getId() == $tblStudent->getServiceManagementCourse()->getId() && $tblItem->getServiceManagementStudentChildRank()->getId() == $tblStudent->getTblChildRank()->getId()) {
                                     $this->actionCreateInvoiceItem($tblCommodity, $tblItem, $tblBasket, $tblBasketItem, $Entity);
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     return true;
 }
Example #16
0
 /**
  * @param TblPerson $tblPerson
  *
  * @return TblDebtor[]|bool
  */
 public function checkDebtorExistsByPerson(TblPerson $tblPerson)
 {
     $tblDebtorAllList = array();
     $debtorPersonAll = Banking::useService()->entityDebtorAllByPerson($tblPerson);
     if (!empty($debtorPersonAll)) {
         foreach ($debtorPersonAll as $debtor) {
             array_push($tblDebtorAllList, $debtor);
         }
     }
     $tblPersonRelationshipList = Management::servicePerson()->entityPersonRelationshipAllByPerson($tblPerson);
     if (!empty($tblPersonRelationshipList)) {
         foreach ($tblPersonRelationshipList as $tblPersonRelationship) {
             if ($tblPerson->getId() === $tblPersonRelationship->getTblPersonA()) {
                 $tblDebtorList = Banking::useService()->entityDebtorAllByPerson($tblPersonRelationship->getTblPersonB());
             } else {
                 $tblDebtorList = Banking::useService()->entityDebtorAllByPerson($tblPersonRelationship->getTblPersonA());
             }
             if (!empty($tblDebtorList)) {
                 foreach ($tblDebtorList as $tblDebtor) {
                     array_push($tblDebtorAllList, $tblDebtor);
                 }
             }
         }
     }
     if (empty($tblDebtorAllList)) {
         return false;
     } else {
         return $tblDebtorAllList;
     }
 }
Example #17
0
 public function base_concurso()
 {
     require_once 'Management.php';
     $link = new Management();
     //  if(isset($_POST['IDCON_']) && $_POST['CONTOKEN']==$link->tokengenerate($_POST['IDCON_']))
     if (isset($_POST['IDCON_'])) {
         $CON_ID = $_POST['IDCON_'];
         $this->view->data = $link->datos_concurso($CON_ID);
         $aspirantes = $link->model->getAspirantesbyCONID($CON_ID);
         $baseconcurso = $this->view->data['fasesConcurso'];
         $this->view->R = 0;
         $this->view->P = 0;
         $this->view->E = 0;
         $colP = array();
         $colR = array();
         $colE = array();
         foreach ($baseconcurso as $key => $value) {
             switch ($value[9]) {
                 case 'P':
                     $this->view->P += $value[3];
                     $colP += [$key => $value];
                     break;
                 case 'R':
                     $this->view->R += $value[3];
                     $colR += [$key => $value];
                     break;
                 case 'E':
                     $this->view->E += $value[3];
                     $colE += [$key => $value];
                     break;
                 default:
                     # code...
                     break;
             }
         }
         $this->view->colMO = ['P' => $colP, 'R' => $colR, 'E' => $colE];
         $meritos = array();
         $oposicion = array();
         foreach ($baseconcurso as $key => $value) {
             if ($value[8] == 'M') {
                 array_push($meritos, array($value[7], $value[3], $value[0]));
             } else {
                 if ($value[8] == 'O') {
                     array_push($oposicion, array($value[7], $value[3], $value[0]));
                 }
             }
         }
         $selectROW = "";
         $stringMeritos = "";
         foreach ($meritos as $key => $value) {
             $stringMeritos .= " ,calificacion_ASP_BCO(ASP_ID," . $value[2] . ")";
         }
         $selectROW .= "nomb_aspbyID(ASP_ID)" . $stringMeritos . ',fobtsummerops(ASP_ID,CON_ID,"M")';
         $stringOposicion = "";
         foreach ($oposicion as $key => $value) {
             $stringOposicion .= " ,calificacion_ASP_BCO(ASP_ID," . $value[2] . ")";
         }
         $selectROW .= $stringOposicion . ',fobtsummerops(ASP_ID,CON_ID,"O") ,fobtsummerops(ASP_ID,CON_ID,"%") ';
         array_push($meritos, array('Subtotal', 50));
         array_push($oposicion, array('Subtotal', 50));
         $this->view->data += ['meritos' => $meritos];
         $this->view->data += ['oposicion' => $oposicion];
         $this->view->data += ['AspirantesROW' => $this->model->calificacionProcesada($selectROW, $CON_ID)];
         //var_dump( $this->view->data);
         //  $this->view->data2=$link->model->getAspirantesbyCONIDBCONID();
         $this->view->render($this, 'base_concurso');
     }
 }
Example #18
0
 /**
  * @return Stage
  */
 public function frontendBankingPerson()
 {
     $Stage = new Stage();
     $Stage->setTitle('Debitorensuche');
     $Stage->addButton(new Primary('Zurück', '/Billing/Accounting/Banking', new ChevronLeft()));
     //        $tblPerson = Management::servicePerson()->entityPersonAll(); // todo
     $tblPerson = false;
     // todo
     if (!empty($tblPerson)) {
         foreach ($tblPerson as $Person) {
             $PersonType = Management::servicePerson()->entityPersonById($Person->getId())->getTblPersonType();
             $Person->Option = (new Primary('Debitor erstellen', '/Billing/Accounting/Banking/Person/Select', new Edit(), array('Id' => $Person->getId())))->__toString();
             $Person->PersonType = $PersonType->getName();
         }
     }
     $Stage->setContent(new Layout(array(new LayoutGroup(array(new LayoutRow(array(new LayoutColumn(array(new TableData($tblPerson, null, array('FirstName' => 'Vorname', 'MiddleName' => 'Zweitname', 'LastName' => 'Nachname', 'PersonType' => 'Persontyp', 'Option' => 'Debitor hinzufügen')))))))))));
     return $Stage;
 }
Example #19
0
 public function GetCurrentCall($template)
 {
     if (LEVEL == 6) {
         $this->sql = "SELECT count(*) as `count` from current_call";
     } else {
         $this->sql = "SELECT count(*) as `count` from current_call where r" . LEVEL . "=" . USERID . "";
     }
     $call = parent::custom();
     parent::RawListView($template);
     $this->view->assign("calls", $call[0]['count']);
 }
<?php

//if receive request from signup, call server to insert user info to database
require_once $_SERVER["DOCUMENT_ROOT"] . 'Tam-An-Food-Store-Manager/' . 'config.php';
if (isset($_POST['request'])) {
    require_once CLASS_PATH . "Management.php";
    require_once FUNCTION_PATH . "functions.php";
    $data = array();
    $data['username'] = $_POST['username'];
    $data['name'] = $_POST['name'];
    $data['email'] = $_POST['email'];
    $data['password'] = $_POST['password'];
    $data['password_confirm'] = $_POST['password_confirm'];
    $manage = new Management();
    print_r($manage->sign_up($data));
    redirect_to(CONFIG_PATH("public_HTML") . "login/");
}