
    {lf(	                     L    d dl mZ d dlmZ d dlmZmZ d dlmZ d dlm	Z	 d Z
dS )    )login_required)Count)now	timedelta)datetime)	Customersc           	      `   	 t                                                      }|t          |                                          z
  }|                    d          }|                    dd          }t
          j                            |           }|                                }|                    |                                          }|                    |                                          }|                    |                                          }	|                    |                                          }
|                    d	          	                    d
                                          }|                    d
d g                                          }g }t          d          D ]}|                    d          t          |dz            z
  }|                    d          t          d          z                       d          t          d          z
  }|                    ||                                          }|                    |                    d          |d           ||||	|
|||dS # t          $ r}i cY d }~S d }~ww xY w)N)days   )day)monthr   )$batch__category__created_by__company)created__date)created__date__gteF)password__isnull )password)password__in            )r   created__date__ltez%Y-%m)r   count)total_customerscustomers_todaycustomers_this_weekcustomers_this_monthcustomers_this_year
registeredunregisteredlast_12_months_customers)r   dater   weekdayreplacer   objectsfilterr   excluderangeappendstrftime	Exception)companytodaystart_of_weekstart_of_monthstart_of_year	customersr   r   r   r   r   r    r!   r"   ifirst_day_of_monthlast_day_of_monthmonth_customerses                      ]D:\MyProjects\RESCUE_SCANNER\qr_onkar_130624\qr_onkar\website\company_view\dashboard_views.pyget_customer_statisticsr9   	   s   .

	u}} ? ? ??1--A155%,,RY,ZZ	#//++#***??EEGG'..-.PPVVXX(//>/RRXXZZ'..-.PPVVXX%%u%==EErERRXXZZ
 ''b$Z'@@FFHH#% r 	 	A!&1!5!5	q2v8N8N8N!N!3!;!;!;!C!CiUVFWFWFW!W ` `ef ` g gjsk k k ! (..#5#4 /   egg 
 %+++44W==(- -      /.#6$8#6$((@	
 	
 		
    						s   JJ 
J-!J("J-(J-N)django.contrib.auth.decoratorsr   django.db.modelsr   django.utils.timezoner   r   r   accounts.modelsr   r9        r8   <module>r@      s~    9 9 9 9 9 9 " " " " " " 0 0 0 0 0 0 0 0       % % % % % %/ / / / /r?   