Code:
{ //Lbl_Date_Heure_Effet
x: 10,
y: 85,
xtype: 'label',
cls: 'x-abs-required-layout-item',
text: currentFichePoliceCorpsLabels.Lbl_Date_Heure_Effet + " :"
},
{
x: 120,
y: 85,
xtype: 'label',
id: CurrentSheetID + '_poli_date_effet_label',
text: Format_Date(currentFichePoliceCorps.poli_date_effet)
},
{
x: 120,
y: 80,
xtype: 'datefield',
hidden: ((currentFichePoliceCorps.nbr_note_debit > 0 ,
allowBlank: false,
width: 140,
value: currentFichePoliceCorps.poli_date_effet,
maxValue : currentFichePoliceCorps.poli_date_fin,
format: GlobalListLabels.Format_Date_Time,
id: CurrentSheetID + '_poli_date_effet',
listeners:
{
blur: function(elem)
{
if (elem.isValid())
{
if(elem.getValue() != null && elem.getValue() != "")
{
Ext.getCmp(CurrentSheetID + "_poli_date_fin" ).setMinValue ( elem.getValue() );
}
if(elem.getValue() != null && elem.getValue() != "" && Ext.getCmp(CurrentSheetID + "_poli_date_fin" ).getValue() != "" && Ext.getCmp(CurrentSheetID + "_poli_date_fin" ).getValue() != null)
{
var m = (Ext.getCmp(CurrentSheetID + "_poli_date_fin" ).getValue().getFullYear() - elem.getValue().getFullYear()) * 12 + (Ext.getCmp(CurrentSheetID + "_poli_date_fin" ).getValue().getMonth() - elem.getValue().getMonth());
Ext.getCmp(CurrentSheetID + '_poli_nb_mois').setValue(m);
var j = (Ext.getCmp(CurrentSheetID + "_poli_date_fin" ).getValue().getFullYear() - elem.getValue().getFullYear()) * 365 + (Ext.getCmp(CurrentSheetID + "_poli_date_fin" ).getValue().getDay() - elem.getValue().getDay());
Ext.getCmp(CurrentSheetID + '_poli_nb_jours').setValue(j);
Ext.getCmp(CurrentSheetID + '_poli_nb_jours_12m').setValue(j);
var h = (Ext.getCmp(CurrentSheetID + "_poli_date_fin" ).getValue().getFullYear() - elem.getValue().getFullYear()) * 8760 + (Ext.getCmp(CurrentSheetID + "_poli_date_fin" ).getValue().getHours() - elem.getValue().getHours());
Ext.getCmp(CurrentSheetID + '_poli_nb_heures').setValue(h);
}
}
}
}
},
{ //Lbl_Date_Heure_Fin
x: 10,
y: 110,
xtype: 'label',
cls: 'x-abs-required-layout-item',
text: currentFichePoliceCorpsLabels.Lbl_Date_Heure_Fin + " :"
},
{
x: 120,
y: 110,
xtype: 'label',
id: CurrentSheetID + '_poli_date_fin_label',
text: Format_Date(currentFichePoliceCorps.poli_date_fin)
},
{
x: 120,
y: 105,
xtype: 'datefield',
hidden: pasModifiable,
width: 140,
allowBlank: false,
value: currentFichePoliceCorps.poli_date_fin,
minValue : currentFichePoliceCorps.poli_date_effet,
hidden: ((currentFichePoliceCorps.nbr_note_debit > 0,
format: GlobalListLabels.Format_Date_Time,
id: CurrentSheetID + '_poli_date_fin',
listeners:
{
blur: function(elem)
{
if (elem.isValid())
{
if(elem.getValue() != null && elem.getValue() != "")
{
Ext.getCmp(CurrentSheetID + "_poli_date_effet" ).setMaxValue ( elem.getValue() );
}
if(elem.getValue() != null && elem.getValue() != "" && Ext.getCmp(CurrentSheetID + "_poli_date_effet" ).getValue() != "" && Ext.getCmp(CurrentSheetID + "_poli_date_effet" ).getValue() != null)
{
var m = (elem.getValue().getFullYear ()- Ext.getCmp(CurrentSheetID + "_poli_date_effet" ).getValue().getFullYear ()) * 12 + (elem.getValue().getMonth ()- Ext.getCmp(CurrentSheetID + "_poli_date_effet" ).getValue().getMonth ());
Ext.getCmp(CurrentSheetID + '_poli_nb_mois').setValue(m);
var j = (elem.getValue().getFullYear ()- Ext.getCmp(CurrentSheetID + "_poli_date_effet" ).getValue().getFullYear ()) * 365 + (elem.getValue().getMonth ()- Ext.getCmp(CurrentSheetID + "_poli_date_effet" ).getValue().getMonth ());
Ext.getCmp(CurrentSheetID + '_poli_nb_jours').setValue(j);
var h = (elem.getValue().getFullYear ()- Ext.getCmp(CurrentSheetID + "_poli_date_effet" ).getValue().getFullYear ()) * 8760 + (elem.getValue().getMonth ()- Ext.getCmp(CurrentSheetID + "_poli_date_effet" ).getValue().getMonth ());
Ext.getCmp(CurrentSheetID + '_poli_nb_heures').setValue(h);
}
}
}
}
}
thank you for correcting me