Exemplo n.º 1
0
             }
         }
     }
     echo json_encode(array('flag' => true, 'data' => $final));
 } else {
     if (strcmp(trim($_POST['action']), 'ids') == 0) {
         $obdi = new OrderBookDaoImp($entityManager);
         $array = array();
         foreach ($obdi->getAllOrderBooks() as $orderbook) {
             $array[] = $orderbook->getId();
         }
         echo json_encode(array('flag' => true, 'data' => $array));
     } else {
         if (strcmp(trim($_POST['action']), 'updateOrder') == 0) {
             $odi = new OrderDaoImp($entityManager);
             $order = $odi->getOrderById(intval(trim($_POST['id'])));
             if ($order != null) {
                 $order->setOrderDate(new DateTime(trim($_POST['date'])));
                 if (strcmp(trim($_POST['valid']), 'true') == 0) {
                     $order->setValid(true);
                 } else {
                     $order->setValid(false);
                 }
                 $entityManager->flush();
                 echo json_encode(array('flag' => true));
             } else {
                 echo json_encode(array('flag' => false));
             }
         } else {
             if (strcmp(trim($_POST['action']), 'dataClients') == 0) {
                 $array = array();
Exemplo n.º 2
0
 $odi = new OrderDaoImp($entityManager);
 $cdi = new ClientDaoImp($entityManager);
 $obi = new OrderBookDaoImp($entityManager);
 if (isset($_POST['action'])) {
     $see = array();
     $seeall = array();
     $ffinale = array();
     $tmp = array();
     $tmpp = array();
     if (strcmp(trim($_POST['action']), 'edit') == 0) {
         $orderId = intval(trim($_POST['id']));
         $orderDate = new DateTime(trim($_POST['data']['orders']['Order Date']));
         $orderValid = trim($_POST['data']['orders']['Valid']);
         $clientId = intval(trim($_POST['data']['orders']['Client Id']));
         $orderBookId = trim($_POST['data']['orders']['Order Book Id']);
         $order = $odi->getOrderById($orderId);
         $client = $cdi->getClientById($clientId);
         if ($order !== null) {
             $order->setOrderDate($orderDate);
             if (strcmp(strtolower($orderValid), 'true') === 0) {
                 $order->setValid(true);
             } else {
                 $order->setValid(false);
             }
             if ($client !== null) {
                 $order->setClient($client);
             }
             $entityManager->flush();
             $array['DT_RowId'] = $orderId;
             $see['Order Date'] = $orderDate->format("d-m-Y");
             if ($order->getValid()) {
Exemplo n.º 3
0
// 						$tmpp[] = $tmp;
// 					} else {
// 						foreach ( $order->getOrderBook () as $orderbook ) {
// 							$array ["DT_RowId"] = "" . $order->getId () . "";
// 							json_encode ( $array );
// 							$inter ["Order Date"] = $order->getDate ()->format ( 'd/m/Y' );
// 							if($order->getValid ())$inter ["Valid"] = "true";
// 							else $inter ["Valid"] = "false";
// 							$inter ["Client Id"] = $order->getClient ()->getId ();
// 							$inter ["Client Name"] = $order->getClient ()->getName ();
// 							$inter ["Order Book Ids"] = "" . $cpt . "";
// 							$array ['orders'] = $inter;
// 							json_encode ( $array );
// 							$demi ["id"] = "" . $orderbook->getId () . "";
// 							$array ["Order Book Ids"] = $demi;
// 							json_encode ( $array );
// 							$see['value'] = "".$cpt."";
// 							$see['label'] = "" . $orderbook->getId () . "";
// 							$seeall[] = $see;
// 						}
// 					}
// 					$cpt ++;
// 					$final [] = $array;
// 				}
// 					$ffinal['orders.Order Book Id'] = $seeall;
// 					$ffinal['orders.Client Id'] = $tmpp;
// 				echo json_encode ( array (
// 						'data' => $final,'options'=>$ffinal
// 				) );
$order = $odi->getOrderById(4);
$order->removeOrderBook($orderbook);