Sindbad~EG File Manager

Current Path : /home/numerotech/bni.numerotech.com/bni_hallmark/core/library/__pycache__/
Upload File :
Current File : //home/numerotech/bni.numerotech.com/bni_hallmark/core/library/__pycache__/Xlsexport.cpython-37.pyc

B

���e*�@s�ddlmZddlmZddlZddlmZddlmZddlZddlmZddl	Z	ddl	m
Z
mZm	Z	ddlZddl
ZddlmZd	d
lmZGdd�d�ZdS)
�)�Response)�listdirN)�StringIO)�BytesIO)�Workbook)�	timedelta�date�datetime)�defaultdict�)�Helperc@s(eZdZddd�Zdd�Zd	dd�ZdS)
�	XLSEXPORTNcCs(t��}|�d�}t��}t��}|�d�}	d}
d}|�r$|rXt|�	��}t|�
��}nt|d�	��}|}x"|D]}
|	�d||
�|d7}qrWd}xD|D]<}
x*|D]"}|	�|
d||
|�|d7}q�Wd}|
d7}
q�W|�|�|�
d�t|dddt|�dt|�d	t|�d
id�SdS)Nz%Y-%m-%d %H:%MZsheet1r�zapplication/ms-excelzContent-Dispositionzattachment;filename=�_delegates_�_report_z.xls)�mimetype�headers)r	�now�strftime�ior�xlwtr�	add_sheet�list�keys�values�write�save�seekr�str)�self�conf_key�row_data�	file_name�headerrr�outputr�sh�idx�a�row_keys�row�b�i�r,�|C:\Users\Admin\Dropbox\Dev Team\Ramya Works\GITHUB\Common Delegate Registration\common_delegate_v1\core\library\Xlsexport.py�export_singlesheet_xlsDs6






6z XLSEXPORT.export_singlesheet_xlsc#Cs�tt�}tt�}tt�}g}	x8|D]0}
||
d�|
�|
d|	kr"|	�|
d�q"Wx|D]}
||
d�|
�q\Wx|D]}
||
d�|
�q|Wt��}t��}�x�|	D�]�}
g}x"||
D]}
|
d}|�|�q�W|dk�rHt|�d}ddddd	d
ddd
ddg|ddddg}dddddddddddg|dd d!d"g}n`t|�d}dddd#d$d
ddd
dd%g|ddddg}dddd&dddddddg|dd d!d"g}tt�}x$||
D]}
||
d'�|
��q�W|
�d(d)��	�}|dd*�d+t|�d*k}|�
|�}d,}d,}x(|D] }|�d,||�d,}|d-7}�qWt|�d}t|�}t�d.�}�x>||
D�]0}d,}d,}d,} �x|D�]}!t
|�t
|�k�r~|d/k�r>t
|�t
|�k�r&x�||!D]`}"|d0|"d0k�r�|d1|"d2k�r|j|d-|d3|d4�n|�|d-||"d5�| d-7} �q�Wn|�|d-|||!�n|�|d-|||!�|d-7}t
|�| k�rtd,}d,} n|d-7}nd,}d,} �q�Wd,}|d-7}�qhWq�W|�|�|�d,�t|d6d7d8|d9id:�S);NZcat_name�	full_nameZIC�ZAbs_noZTitleZSynopsiszChief instrutorz
Date of Birth�Agez
Membership NoZEmailZMobilezPresentation typez
Co-InstructorzAssigned EvaluatorszCompleted EvaluatorsZTotalZAverageZabs_no�titleZsynopsisZpresenting_authorZdob�ageZpresenting_membershipnoZpresenting_emailZpresenting_mobileZpresenting_typeZ	co_author�	total_evaZ	evaluatedZtotal_marksZ
percentagezChief authorzpresenting authorz	Co-AuthorZchief_authorZe_full_name�/��z..rrz�pattern: pattern solid, fore_colour yellow;font: colour black, bold True, name Calibri, height 180; align: vert centre, horiz centre;border: left thin,right thin,top thin,bottom thin�
Zabs_idZ
pa_user_idZeva_user_idzN/A)�styleZmarks_totalzapplication/ms-excelzContent-Dispositionzattachment;filename=z.xls)rr)r
r�appendrrrr�len�replace�striprrZeasyxf�intrrr)#rZ
abstract_dataZ
marks_dataZ	evaluatorZabs_typer"Z	abstractsZevaluator_listZ
marks_list�
categories�rr$r�catr/�f_nameZ
eva_length�col_nameZexport_columnsZ
marks_dict�
sheet_namer%r&r'r)Zsno_valr4Zcol_lenr9�datar*�c�dr+�jr,r,r-�evaluation_summary_xlsbs�



*,**







z XLSEXPORT.evaluation_summary_xlsc	Cs�t��}|�d�}t��}t��}	|r@t|���}
t|�	��}nt||d���}|}
d}|�r�|�r�x�|D]�}|rz|n
dt
|�}|dt�|�}
|
dd�dt
|
�dk}
|	�|
�}d}d}x"|D]}|�d||�|d7}q�Wd}xJ||D]>}x,|
D]$}|�|d|||�|d7}�qWd}|d7}q�WqnW|	�|�|�d�t|ddd	t
|�d
t
|�dt
|�did
�SdS)Nz%Y-%m-%d %H:%MrrZSheetr7z..zapplication/ms-excelzContent-Dispositionzattachment;filename=rrz.xls)rr)r	rrrrrrrrrrr�convert_special_charr;rrrrr)rr Zsheet_namesr!r"r#rrr$rr(rG�looprDr%r&r'r)r*r+r,r,r-�export_multiplesheet_xls�sB







6z"XLSEXPORT.export_multiplesheet_xls)N)N)�__name__�
__module__�__qualname__r.rIrLr,r,r,r-r
s5
Mr
)�flaskr�osrrrrZ
xlsxwriterrr	rrrZflask_excel�excel�collectionsr
r6rr
r,r,r,r-�<module>s

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists