예제 #1
0
 public function actionAddsale()
 {
     $session = new Session();
     $session->open();
     if (!empty($_POST['sales'])) {
         Invoicerefsale::deleteAll('invid = :invid', [':invid' => $session['invid']]);
         foreach ($_POST['sales'] as $data) {
             $model2 = new \backend\models\Invoicerefsale();
             $model2->invid = $session['invid'];
             $model2->saleid = $data;
             $model2->save();
         }
         return $this->redirect(['saleorderinvoice/update', 'id' => $session['invid']]);
     }
 }
예제 #2
0
 /**
  * Deletes an existing Saleorderinvoice model.
  * If deletion is successful, the browser will be redirected to the 'index' page.
  * @param integer $id
  * @return mixed
  */
 public function actionDelete($id)
 {
     if ($this->findModel($id)->delete()) {
         $deldetail = \backend\models\Saleorderinvoiceline::deleteAll('invid = :invid', [':invid' => $id]);
         $deldetail2 = \backend\models\Invoicerefsale::deleteAll('invid = :invid', [':invid' => $id]);
         if ($deldetail) {
             return $this->redirect(['index']);
         }
         return $this->redirect(['index']);
     }
 }