
    {h8-                     ,   S SK r S SKJrJr  S SKJr  S SKJr  S SKJ	r	  S SK
rS SKJrJrJr  S SKJrJr   " S S	\	\5      r " S
 S\	\5      r " S S\	\5      r " S S\	\5      r " S S\	\5      r " S S\	\5      r " S S\	\5      r " S S\	\5      rg)    N)renderredirect)View)messages)LoginRequiredMixin)
AttendanceTeamVendors)User_Departments
User_Typesc                        \ rS rSrS rS rSrg)TeamRegistrationView   c                     [         R                  R                  5       n[        R                  R                  5       n[	        USX#S.5      $ )Nzteam-registration.html)departmentsdesignations)r   objectsallr   r   )selfrequestr   r   s       )/var/www/html/KUNJ/hr_department/views.pygetTeamRegistrationView.get   s=    &..224!))--/g7+9uvv    c                 	   [        5       nUR                  R                  S5      Ul        SR	                  S [        S5       5       5      Ul        UR                  R                  S5      Ul        UR                  R                  S5      Ul        UR                  R                  S5      Ul	        UR                  R                  S5      Ul
        UR                  R                  S	5      Ul        UR                  R                  S
5      Ul        UR                  R                  S5      Ul        UR                  R                  S5      Ul        UR                  R                  S5      Ul        UR                  R                  S5      Ul        UR                  R                  S5      Ul        UR                  R                  S5      Ul        UR                  R                  S5      Ul        UR                  R                  S5      Ul        UR                  R                  S5      Ul        UR                  R                  S5      Ul        UR                  R                  S5      Ul        UR                  R                  S5      Ul        UR                  R                  S5      Ul        UR                  R                  S5      Ul        UR                  R                  S5      Ul        UR                  R                  S5      Ul        UR:                  R                  S5      Ul        UR:                  R                  S5      Ul        UR:                  R                  S5      Ul         UR:                  R                  S5      Ul!        UR:                  R                  S5      Ul"        UR                  R                  S 5      Ul#        UR:                  R                  S!5      Ul$        UR                  R                  S"5      Ul%        UR                  R                  S#5      Ul&        UR                  R                  S$5      Ul'        UR                  R                  S%5      Ul(        S&UR:                  ;   a   UR:                  R                  S"5      Ul)        URU                  5         [V        RX                  " US'5        [[        S(5      $ ))Nemployment_type c              3   N   #    U  H  n[         R                  " S 5      v   M     g7f$1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZNrandomchoice.0is     r   	<genexpr>,TeamRegistrationView.post.<locals>.<genexpr>         #lck^_FMM2X$Y$Yck   #%   positionnamefather_namemother_nameemailmobiledate_of_birthgenderqualification
university
experiencemarital_statusemergency_contact_nojoining_datedesignation
departmentpayment_typebasic_amount
ctc_amountepfesicpan_nophotoresumeaadharpan_card	marksheetaddressmessageassets	condition
issue_datereturn_datedeclaration$Team member registered successfully.TeamView).r	   POSTr   r   joinrangeemployee_idr,   r-   r.   r/   r0   r1   r2   r3   r4   r5   r6   r7   r8   r9   designation_iddepartment_idr<   r=   r>   r?   r@   rA   FILESrB   rC   rD   rE   rF   rG   rH   rI   rJ   rK   rL   rM   saver   successr   )r   r   teams      r   postTeamRegistrationView.post   sk   v&||//0AB77#lchijck#lm((4LL$$V,	"<<++M:"<<++M:\\%%g.
ll&&x0$\\--o>ll&&x0$\\--o>!,,**<8!,,**<8%ll../?@$+LL$4$45K$L!#LL,,^<%ll..}=$\\--l;#LL,,^<#LL,,^<!,,**<8<<##E*LL$$V,	ll&&x0]]&&w/
mm''1mm''1))*5 **;7||''	2}}((3ll&&x0 ))+6!,,**<8"<<++M:GMM)&}}00:D		"HI
##r    N__name__
__module____qualname____firstlineno__r   rZ   __static_attributes__r\   r   r   r   r      s    w)$r   r   c                        \ rS rSrS rS rSrg)rO   B   c                 \    [         R                  R                  5       n[        USSU05      $ )Nz	team.htmlmembers)r	   r   r   r   )r   r   rf   s      r   r   TeamView.getD   s(    ,,""$g{Y,ABBr   c                 P    UR                   R                  S5      n[        R                  R                  US9nUR	                  5         [
        R                  " US5        [        S5      $ ! [        R                   a%    [
        R                  " US5        [        S5      s $ f = f)Nidri   z!Team member deleted successfully.rO   zTeam member not found.)
rP   r   r	   r   deleter   rX   r   DoesNotExisterrorr   r   ri   rY   s       r   rZ   TeamView.postJ   s    	(!!$'B<<##r#*DKKMW&IJJ''   	(NN7$<=J''	(   A)A, ,6B%$B%r\   Nr]   r\   r   r   rO   rO   B   s    C	(r   rO   c                        \ rS rSrS rS rSrg)
MemberViewV   c                     [         R                  R                  US9n[        R                  R	                  5       n[
        R                  R	                  5       n[        USX4US.5      $ )Nrj   zedit-team.html)rY   r   r   )r	   r   r   r   r   r   r   )r   r   ri   rY   r   r   s         r   r   MemberView.getW   sW    ||R(&..224!))--/g/4o{1|}}r   c                 l
   [         R                  R                  US9nUR                  R                  S5      Ul        SR                  S [        S5       5       5      Ul        UR                  R                  S5      Ul        UR                  R                  S5      Ul	        UR                  R                  S5      Ul
        UR                  R                  S	5      Ul        UR                  R                  S
5      Ul        UR                  R                  S5      Ul        UR                  R                  S5      Ul        UR                  R                  S5      Ul        UR                  R                  S5      Ul        UR                  R                  S5      Ul        UR                  R                  S5      Ul        UR                  R                  S5      Ul        UR                  R                  S5      Ul        UR                  R                  S5      Ul        UR                  R                  S5      Ul        UR                  R                  S5      Ul        UR                  R                  S5      Ul        UR                  R                  S5      Ul        UR                  R                  S5      Ul        UR                  R                  S5      Ul        UR                  R                  S5      Ul        UR                  R                  S5      Ul        UR                  R                  S5      Ul        UR>                  R                  S5      Ul         UR                  R                  S5      Ul!        UR                  R                  S5      Ul"        UR                  R                  S 5      Ul#        UR                  R                  S!5      Ul$        S"UR>                  ;   a   UR>                  R                  S"5      Ul%        S#UR>                  ;   a   UR>                  R                  S#5      Ul&        S$UR>                  ;   a   UR>                  R                  S$5      Ul'        S%UR>                  ;   a   UR>                  R                  S%5      Ul(        S&UR>                  ;   a   UR>                  R                  S&5      Ul)        S'UR>                  ;   a   UR>                  R                  S5      Ul*        URW                  5         [X        RZ                  " US(5        []        S)5      $ )*Nrj   r   r   c              3   N   #    U  H  n[         R                  " S 5      v   M     g7fr   r!   r$   s     r   r'   "MemberView.post.<locals>.<genexpr>a   r)   r*   r+   r,   r-   r.   r/   r0   r1   r2   r3   r4   r5   r6   r7   r8   r9   r:   r;   r<   r=   r>   r?   r@   rA   rG   rH   rI   rJ   rK   rL   rB   rC   rD   rE   rF   rM   rN   rO   )/r	   r   r   rP   r   rQ   rR   rS   r,   r-   r.   r/   r0   r1   r2   r3   r4   r5   r6   r7   r8   r9   rT   rU   r<   r=   r>   r?   r@   rA   rG   rV   rH   rI   rJ   rK   rL   rB   rC   rD   rE   rF   rM   rW   r   rX   r   rn   s       r   rZ   MemberView.post^   s   ||R(&||//0AB77#lchijck#lm((4LL$$V,	"<<++M:"<<++M:\\%%g.
ll&&x0$\\--o>ll&&x0$\\--o>!,,**<8!,,**<8%ll../?@$+LL$4$45K$L!#LL,,^<%ll..}=$\\--l;#LL,,^<#LL,,^<!,,**<8<<##E*LL$$V,	ll&&x0||''	2}}((3ll&&x0 ))+6!,,**<8"<<++M:gmm# **73DJw}}$!--++H5DKw}}$!--++H5DK&#MM--j9DM'--'$]]..{;DNGMM)&}}00:D		"HI
##r   r\   Nr]   r\   r   r   rr   rr   V   s    ~.$r   rr   c                        \ rS rSrS rS rSrg)AttendanceView   c                    [         R                  R                  5       n[        R                  R	                  SSS9R                  5       R                  S5      n[        UR                  5        SUR                  ;   a  UR                  S   S:w  a  SUR                  ;   a|  UR                  S   S:w  ai  [        R                  R                  [        UR                  S   5      [        UR                  S   5      S9nUR                  S   nUR                  S   nOn[        R                  R                  S5      R                  5       nU(       a  UR                  nUR                  nOS nS n[        R                  R                  XeS9n/ nU GH4  n	[        R                  " U	R                   R"                  5      n
U
S   R%                  5       R'                  5       nUR)                  S	S
5      nUR)                  SS
5      nUR)                  SS
5      nUR)                  SS
5      nU
S   R+                  5       nUR-                  U	R.                  R0                  U	R.                  R2                  U	R.                  R4                  U	R.                  R6                  UUUUU	R                   R8                  [;        US5      S.
5        GM7     [=        USXX5US.5      $ )NyearT)flatr   month)r   r~   z-idStatusPresentr   AbsentLeaveHolidayzWorking Hours   )
rS   r0   r1   r-   presentabsentleaveholidayfiletotal_hourszattendance.html)
attendancerf   yearsr~   r   )r	   r   r   r   values_listdistinctorder_byprintGETfilterintfirstr~   r   pd
read_excelr   pathvalue_countsto_dictr   sumappendmemberrS   r0   r1   r-   urlroundr   )r   r   rf   r   attendancesr~   r   last_attendanceresultsattdfcountsr   r   r   r   r   s                    r   r   AttendanceView.get   s^   ,,""$""..vD.AJJLUUV\]gkkW[[ W[[%8B%>7gkkCY^e^i^ijq^rvx^x$,,33#gkk'>R:SZ]^e^i^ijp^qZr3sK;;v&DKK(E(0099%@FFHO&++'--$,,33%3KKCsxx}}-B\..088:FjjA.GZZ!,FJJw*EjjA.G_-113KNN"zz55))**++

" #$[!4  ( g0'jo  KP  3Q  R  	Rr   c                     [         R                  R                  UR                  R                  S5      UR                  R                  S5      UR                  R                  S5      S9nUR                  R                  S5      Ul        UR                  R                  S5      Ul        UR                  R                  S5      Ul        UR                  R                  S5      Ul	        UR                  5         [        R                  " US5        [        S5      $ ! [         R                   a    [        5       n Nf = f)N	member_idr   r~   )r   r   r~   r   zAttendance saved successfully.r{   )r   r   r   rP   rl   r   r   r~   rV   r   rW   r   rX   r   )r   r   r   s      r   rZ   AttendanceView.post   s   	&#++//GLL<L<L[<Ycjcococscst{c|  FM  FR  FR  FV  FV  W]  F^/  _J  '||//<
"<<++G4
!,,**62
!--++F3
"BC()) && 	&#J	&s   A*D D?>D?r\   Nr]   r\   r   r   r{   r{      s    'RT*r   r{   c                       \ rS rSrS rSrg)MemberDetailView   c                      [         R                  R                  US9n[        USSU05      $ ! [         R                   a    [        S5      s $ f = f)Nrj   zmember.htmlr   rO   )r	   r   r   r   rl   r   )r   r   ri   r   s       r   r   MemberDetailView.get   sR    	(\\%%2%.F'=8f2EFF   	(J''	(s   +. AAr\   N)r^   r_   r`   ra   r   rb   r\   r   r   r   r      s    (r   r   c                        \ rS rSrS rS rSrg)VendorRegistrationView   c                     [        US5      $ )Nzvendor-registration.html)r   )r   r   s     r   r   VendorRegistrationView.get   s    g9::r   c                 :   [        5       nUR                  R                  S5      Ul        UR                  R                  S5      Ul        UR                  R                  S5      Ul        UR                  R                  S5      Ul        UR                  R                  S5      Ul        UR                  R                  S5      Ul	        UR                  R                  S5      Ul
        UR                  5         [        R                  " US5        [        S	5      $ )
Nr-   r0   r1   rA   rE   rG   rH   zVendor registered successfully.
VendorView)r
   rP   r   r-   r0   r1   rA   rV   rE   rG   rH   rW   r   rX   r   )r   r   vendors      r   rZ   VendorRegistrationView.post   s    ll&&v.||''0((2((2!--++J7 )))4 **95"CD%%r   r\   Nr]   r\   r   r   r   r      s    ;&r   r   c                        \ rS rSrS rS rSrg)r      c                 \    [         R                  R                  5       n[        USSU05      $ )Nzvendors.htmlvendors)r
   r   r   r   )r   r   r   s      r   r   VendorView.get   s(    //%%'g~	G/DEEr   c                 P    UR                   R                  S5      n[        R                  R                  US9nUR	                  5         [
        R                  " US5        [        S5      $ ! [        R                   a%    [
        R                  " US5        [        S5      s $ f = f)Nri   rj   zVendor deleted successfully.r   zVendor not found.)rP   r   r
   r   rk   r   rX   r   r	   rl   rm   r   r   ri   r   s       r   rZ   VendorView.post   s    	*!!$'B__((B(/FMMOW&DEL))   	*NN7$78L))	*rp   r\   Nr]   r\   r   r   r   r      s    F
	*r   r   c                        \ rS rSrS rS rSrg)VendorMemberView   c                 Z    [         R                  R                  US9n[        USSU05      $ )Nrj   zedit-vendor.htmlr   )r
   r   r   r   r   s       r   r   VendorMemberView.get   s.    $$"$-g1Hv3FGGr   c                    [         R                  R                  US9nUR                  R                  S5      Ul        UR                  R                  S5      Ul        UR                  R                  S5      Ul        UR                  R                  S5      Ul        SUR                  ;   a   UR                  R                  S5      Ul	        UR                  R                  S5      Ul
        UR                  R                  S5      Ul        UR                  5         [        R                  " US	5        [        S
5      $ )Nrj   r-   r0   r1   rA   rE   rG   rH   zVendor updated successfully.r   )r
   r   r   rP   r-   r0   r1   rA   rV   rE   rG   rH   rW   r   rX   r   r   s       r   rZ   VendorMemberView.post  s    $$"$-ll&&v.||''0((2((2&%mm//
;FO )))4 **95"@A%%r   r\   Nr]   r\   r   r   r   r      s    H&r   r   )r"   django.shortcutsr   r   django.viewsr   django.contribr   django.contrib.auth.mixinsr   pandasr   hr_department.modelsr   r	   r
   users.modelsr   r   r   rO   rr   r{   r   r   r   r   r\   r   r   <module>r      s     -  # 9  ; ; 51$-t 1$l(!4 ((6$#T 6$r7*' 7*t()4 (&/ &**#T *(&)4 &r   