Nomina.php 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <?php
  2. namespace app\models;
  3. use Yii;
  4. /**
  5. * This is the model class for table "Nomina".
  6. *
  7. * @property string $id
  8. * @property string|null $idEmpleado
  9. * @property string|null $idObra
  10. * @property string|null $idUsuario
  11. * @property float|null $montoPagado
  12. * @property float|null $descuento
  13. * @property string|null $creado
  14. * @property string|null $fechaPago
  15. * @property string|null $modificado
  16. * @property string|null $eliminado
  17. *
  18. * @property Empleado $idEmpleado0
  19. * @property Obra $idObra0
  20. * @property Usuario $idUsuario0
  21. */
  22. class Nomina extends ModeloBase
  23. {
  24. /**
  25. * {@inheritdoc}
  26. */
  27. public static function tableName()
  28. {
  29. return 'Nomina';
  30. }
  31. /**
  32. * {@inheritdoc}
  33. */
  34. public function rules()
  35. {
  36. return [
  37. [['id'], 'required'],
  38. [['montoPagado', 'descuento'], 'number'],
  39. [['creado', 'fechaInicio','fechaFin', 'modificado', 'eliminado'], 'safe'],
  40. [['id', 'idEmpleado', 'idObra', 'idUsuario'], 'string', 'max' => 36],
  41. [['id'], 'unique'],
  42. [['idEmpleado'], 'exist', 'skipOnError' => true, 'targetClass' => Empleado::class, 'targetAttribute' => ['idEmpleado' => 'id']],
  43. [['idObra'], 'exist', 'skipOnError' => true, 'targetClass' => Obra::class, 'targetAttribute' => ['idObra' => 'id']],
  44. [['idUsuario'], 'exist', 'skipOnError' => true, 'targetClass' => Usuario::class, 'targetAttribute' => ['idUsuario' => 'id']],
  45. ];
  46. }
  47. /**
  48. * {@inheritdoc}
  49. */
  50. public function attributeLabels()
  51. {
  52. return [
  53. 'id' => 'ID',
  54. 'idEmpleado' => 'Id Empleado',
  55. 'idObra' => 'Id Obra',
  56. 'idUsuario' => 'Id Usuario',
  57. 'montoPagado' => 'Monto Pagado',
  58. 'descuento' => 'Descuento',
  59. 'fechaInicio'=>'fecha Inicio',
  60. 'fechaFin'=>'fecha Fin',
  61. 'creado' => 'Creado',
  62. 'fechaPago' => 'Fecha Pago',
  63. 'modificado' => 'Modificado',
  64. 'eliminado' => 'Eliminado',
  65. ];
  66. }
  67. public function getEmpleado()
  68. {
  69. return $this->hasOne(Empleado::class, ['id' => 'idEmpleado']);
  70. }
  71. public function getObra()
  72. {
  73. return $this->hasOne(Obra::class, ['id' => 'idObra']);
  74. }
  75. public function getUsuario()
  76. {
  77. return $this->hasOne(Usuario::class, ['id' => 'idUsuario']);
  78. }
  79. }