/**
  * Deletes an existing Delivery model.
  * If deletion is successful, the browser will be redirected to the 'index' page.
  * @param integer $id
  * @return mixed
  */
 public function actionDelete($id)
 {
     DeliveryDetail::deleteAll(['delivery_Id' => $id]);
     $model = $this->findModel($id);
     //delete the money to customer
     $customer = $model->customer;
     $customer->unpay -= $model->money;
     $customer->sum -= $model->money;
     $customer->save();
     $model->delete();
     return $this->redirect(['index']);
 }