<commit_before><div class="top-pad"></div>

<div class="content-padding" ng-show="ready">

	<h1 class="title left"><i class="fa fa-bank"></i><span>New Payment - Restaurants</span></h1>

	<div class="divider"></div>

	<form name="form" novalidate ng-show="showForm">

		<ul ng-class="{'submitted':submitted}" class="ul-inputs box-content">

			<li class="li-input" ng-class="{'error':form.rangeStart.$invalid}">
				<div class="label">Date start:</div>
				<div class="input"><input type="date" name="rangeStart" ng-model="range.start" required placeholder=""></div>
				<div class="box-error">
					<small ng-show="form.rangeStart.$error.required">Required.</small>
					<small ng-show="form.rangeStart.$error.date">Enter a valid start date!</small>
				</div>
			</li>

			<li class="li-input" ng-class="{'error':form.rangeEnd.$invalid}">
				<div class="label">Date end:</div>
				<div class="input"><input type="date" name="rangeEnd" ng-model="range.end" required placeholder=""></div>
				<div class="box-error">
					<small ng-show="form.rangeEnd.$error.required">Required.</small>
					<small ng-show="form.rangeEnd.$error.date">Enter a valid end date!</small>
				</div>
			</li>

			<li class="li-input" ng-class="{'error':form.paymentType.$invalid}">
				<div class="label">Payment type:</div>
				<select name="paymentType" required ng-model="pay_type" ng-options="opt.value as opt.name for opt in pay_type_options" class="cart-customize-select"></select>
				<div class="box-error">
					<small ng-show="form.paymentType.$error.required">Required.</small>
				</div>
			</li>

			<li class="li-input" ng-show="!isSearching">
				<button class="button save" ng-click="begin();">Begin</button>
			</li>

			<li class="li-input" ng-show="isSearching">
				<span><i class="fa fa-circle-o-notch fa-spin"></i> Loading</span>
			</li>

		</ul>

	</form>

	<div class="box-content" ng-show="!showForm">
		<p>
			Listing orders from <strong>{{range.start | date:'MM/dd/yyyy'}}</strong> to <strong>{{range.end | date:'MM/dd/yyyy'}}</strong> and payment method <strong>{{pay_type_label}}</strong>.
			<br>
			<span class="link" ng-click="showForm = true">Show form</span>
		</p>
	</div>

	<div ng-if="result">

		<h2 class="title">
			<span>Summary</span>
		</h2>

		<div>
			<table class="tb-grid tb-zebra summary">
				<tbody>
					<tr>
						<td>Total of Restaurants</td>
						<td>{{total_restaurants}}</td>
					</tr>
					<tr>
						<td>Total of Orders</td>
						<td>{{total_orders}}</td>
					</tr>
					<tr>
						<td>Total of Not Included Orders</td>
						<td>{{total_not_included}}</td>
					</tr>
					<tr>
						<td>Total of Reimbursed Cash Orders</td>
						<td>{{total_reimburse_cash_orders}}</td>
					</tr>
					<tr positive-or-negative-color="{{total_payments}}">
						<td>Total Payments</td>
						<td>$ {{total_payments | formatPrice}}</td>
					</tr>
				</tbody>
			</table>

		</div>

		<table class="tb-grid tb-zebra">
			<thead>
				<tr>
					<td class="td-medium">Restaurant</td>
					<td class="td-medium">Total Due</td>
					<td></td>
				</tr>
			</thead>
			<tbody>
				<tr ng-repeat="restaurant in result.restaurants" ng-class="{ 'excluded': !restaurant.pay }">
					<td>{{restaurant.name}}</td>
					<td>$ {{restaurant.total_due | formatPrice}}</td>
					<td><span class="link details orange" ng-click="show_details(restaurant)">
						<span ng-show="!restaurant.show_details">Show</span> <span ng-show="restaurant.show_details">Hide</span> Details</span></td>
				</tr>
			</tbody>
		</table>

		<br/><br/>

		<h2 class="title">
			<span>Total Amounts</span>
		</h2>

		<table class="tb-grid tb-zebra">
			<tr positive-or-negative-color="{{sum.card_subtotal}}">
				<td>Credit Card Subtotal</td>
				<td>$ {{sum.card_subtotal | formatPrice}}</td>
			</tr>
			<tr positive-or-negative-color="{{sum.tax}}">
				<td>Tax</td>
				<td>$ {{sum.tax | formatPrice}}</td>
			</tr>
			<tr positive-or-negative-color="{{sum.delivery_fee}}">
				<td>Delivery Fee</td>
				<td>$ {{sum.delivery_fee | formatPrice}}</td>
			</tr>
			<tr positive-or-negative-color="{{sum.tip}}">
				<td>Tip</td>
				<td>$ {{sum.tip | formatPrice}}</td>
			</tr>
			<tr positive-or-negative-color="{{sum.promo_gift_card}}">
				<td>Promo Gift Card</td>
				<td>$ {{sum.promo_gift_card | formatPrice}}</td>
			</tr>
			<tr positive-or-negative-color="{{sum.apology_gift_card}}">
				<td>Apology Gift Card</td>
				<td>$ {{sum.apology_gift_card | formatPrice}}</td>
			</tr>
			<tr positive-or-negative-color="{{sum.cash_reimburse}}">
				<td>Cash Reimburse</td>
				<td>$ {{sum.cash_reimburse | formatPrice}}</td>
			</tr>
			<tr positive-or-negative-color="{{sum.cash_subtotal}}">
				<td>Cash Subtotal</td>
				<td>$ {{sum.cash_subtotal | formatPrice}}</td>
			</tr>
			<tr positive-or-negative-color="{{sum.credit_charge}}">
				<td>Credit Card Charge</td>
				<td>$ {{sum.credit_charge | formatPrice}}</td>
			</tr>
			<tr positive-or-negative-color="{{sum.restaurant_fee}}">
				<td>Crunchbutton Fees</td>
				<td>$ {{sum.restaurant_fee | formatPrice}}</td>
			</tr>
			<tr positive-or-negative-color="{{sum.adjustment}}">
				<td>Adjustments</td>
				<td>$ {{sum.adjustment | formatPrice}}</td>
			</tr>
			<tr class="total-due" positive-or-negative-color="{{sum.total_due}}">
				<td class="td-medium">Total due</td>
				<td class="td-medium">$ {{sum.total_due | formatPrice}}</td>
			</tr>
		</table>

		<ul class="ul-inputs box-content">
			<li class="li-input">
				<button class="button button-big save" ng-click="schedule();">Pay Restaurants</button>
			</li>
		</ul>

		<br/><br/>

		<h2 class="title" id="refunded-orders" ng-show="total_refunded">
			<span>Refunded Orders</span>
		</h2>

		<div ng-show="total_refunded">
			<table class="tb-grid tb-zebra">
					<thead>
						<tr>
							<td></td>
							<td>#</td>
							<td class="td-medium">Restaurant</td>
							<td class="td-medium">Name</td>
							<td>Amount</td>
							<td>Payment</td>
							<td class="td-medium">Date</td>
							<td></td>
							<td></td>
							<td></td>
						</tr>
					</thead><commit_msg>implement additional payment math in Settlement.php #2250<commit_after><div class="top-pad"></div>

<div class="content-padding" ng-show="ready">

	<h1 class="title left"><i class="fa fa-bank"></i><span>New Payment - Restaurants</span></h1>

	<div class="divider"></div>

	<form name="form" novalidate ng-show="showForm">

		<ul ng-class="{'submitted':submitted}" class="ul-inputs box-content">

			<li class="li-input" ng-class="{'error':form.rangeStart.$invalid}">
				<div class="label">Date start:</div>
				<div class="input"><input type="date" name="rangeStart" ng-model="range.start" required placeholder=""></div>
				<div class="box-error">
					<small ng-show="form.rangeStart.$error.required">Required.</small>
					<small ng-show="form.rangeStart.$error.date">Enter a valid start date!</small>
				</div>
			</li>

			<li class="li-input" ng-class="{'error':form.rangeEnd.$invalid}">
				<div class="label">Date end:</div>
				<div class="input"><input type="date" name="rangeEnd" ng-model="range.end" required placeholder=""></div>
				<div class="box-error">
					<small ng-show="form.rangeEnd.$error.required">Required.</small>
					<small ng-show="form.rangeEnd.$error.date">Enter a valid end date!</small>
				</div>
			</li>

			<li class="li-input" ng-class="{'error':form.paymentType.$invalid}">
				<div class="label">Payment type:</div>
				<select name="paymentType" required ng-model="pay_type" ng-options="opt.value as opt.name for opt in pay_type_options" class="cart-customize-select"></select>
				<div class="box-error">
					<small ng-show="form.paymentType.$error.required">Required.</small>
				</div>
			</li>

			<li class="li-input" ng-show="!isSearching">
				<button class="button save" ng-click="begin();">Begin</button>
			</li>

			<li class="li-input" ng-show="isSearching">
				<span><i class="fa fa-circle-o-notch fa-spin"></i> Loading</span>
			</li>

		</ul>

	</form>

	<div class="box-content" ng-show="!showForm">
		<p>
			Listing orders from <strong>{{range.start | date:'MM/dd/yyyy'}}</strong> to <strong>{{range.end | date:'MM/dd/yyyy'}}</strong> and payment method <strong>{{pay_type_label}}</strong>.
			<br>
			<span class="link" ng-click="showForm = true">Show form</span>
		</p>
	</div>

	<div ng-if="result">

		<h2 class="title">
			<span>Summary</span>
		</h2>

		<div>
			<table class="tb-grid tb-zebra summary">
				<tbody>
					<tr>
						<td>Total of Restaurants</td>
						<td>{{total_restaurants}}</td>
					</tr>
					<tr>
						<td>Total of Orders</td>
						<td>{{total_orders}}</td>
					</tr>
					<tr>
						<td>Total of Not Included Orders</td>
						<td>{{total_not_included}}</td>
					</tr>
					<tr>
						<td>Total of Reimbursed Cash Orders</td>
						<td>{{total_reimburse_cash_orders}}</td>
					</tr>
					<tr positive-or-negative-color="{{total_payments}}">
						<td>Total Payments</td>
						<td>$ {{total_payments | formatPrice}}</td>
					</tr>
				</tbody>
			</table>
		</div>

		<div>
			<span class="link orange" ng-show="!total_amounts" ng-click="total_amounts = true">Show details</span>
			<span class="link orange" ng-show="total_amounts" ng-click="total_amounts = false">Hide details</span>
			<br/><br/>
			<br/><br/>

			<div ng-show="total_amounts">

				<h2 id="totals" class="title">
					<span>Total Amounts</span>
				</h2>

				<table class="tb-grid tb-zebra">
					<tr positive-or-negative-color="{{sum.card_subtotal}}">
						<td>Credit Card Subtotal</td>
						<td>$ {{sum.card_subtotal | formatPrice}}</td>
					</tr>
					<tr positive-or-negative-color="{{sum.tax}}">
						<td>Tax</td>
						<td>$ {{sum.tax | formatPrice}}</td>
					</tr>
					<tr positive-or-negative-color="{{sum.delivery_fee}}">
						<td>Delivery Fee</td>
						<td>$ {{sum.delivery_fee | formatPrice}}</td>
					</tr>
					<tr positive-or-negative-color="{{sum.tip}}">
						<td>Tip</td>
						<td>$ {{sum.tip | formatPrice}}</td>
					</tr>
					<tr positive-or-negative-color="{{sum.promo_gift_card}}">
						<td>Promo Gift Card</td>
						<td>$ {{sum.promo_gift_card | formatPrice}}</td>
					</tr>
					<tr positive-or-negative-color="{{sum.apology_gift_card}}">
						<td>Apology Gift Card</td>
						<td>$ {{sum.apology_gift_card | formatPrice}}</td>
					</tr>
					<tr positive-or-negative-color="{{sum.cash_reimburse}}">
						<td>Cash Reimburse</td>
						<td>$ {{sum.cash_reimburse | formatPrice}}</td>
					</tr>
					<tr positive-or-negative-color="{{sum.cash_subtotal}}">
						<td>Cash Subtotal</td>
						<td>$ {{sum.cash_subtotal | formatPrice}}</td>
					</tr>
					<tr positive-or-negative-color="{{sum.credit_charge}}">
						<td>Credit Card Charge</td>
						<td>$ {{sum.credit_charge | formatPrice}}</td>
					</tr>
					<tr positive-or-negative-color="{{sum.restaurant_fee}}">
						<td>Crunchbutton Fees</td>
						<td>$ {{sum.restaurant_fee | formatPrice}}</td>
					</tr>
					<tr positive-or-negative-color="{{sum.adjustment}}">
						<td>Adjustments</td>
						<td>$ {{sum.adjustment | formatPrice}}</td>
					</tr>
					<tr class="total-due" positive-or-negative-color="{{sum.total_due}}">
						<td class="td-medium">Total due</td>
						<td class="td-medium">$ {{sum.total_due | formatPrice}}</td>
					</tr>
				</table>
			</div>

		</div>

		<table class="tb-grid tb-zebra">
			<thead>
				<tr>
					<td></td>
					<td class="td-medium">Restaurant</td>
					<td class="td-medium">Total Due</td>
				</tr>
			</thead>
			<tbody>
				<tr ng-repeat="restaurant in result.restaurants" ng-class="{ 'excluded': !restaurant.pay }">
					<td><span class="link" ng-click="show_details(restaurant)"><i class="fa fa-pencil-square-o"></i></span></td>
					<td>{{restaurant.name}}</td>
					<td>$ {{restaurant.total_due | formatPrice}}</td>
				</tr>
			</tbody>
		</table>

		<br/><br/>

		<ul class="ul-inputs box-content">
			<li class="li-input">
				<button class="button button-big save" ng-click="schedule();">Pay Restaurants</button>
			</li>
		</ul>

		<br/><br/>

		<h2 class="title" id="refunded-orders" ng-show="total_refunded">
			<span>Refunded Orders</span>
		</h2>

		<div ng-show="total_refunded">
			<table class="tb-grid tb-zebra">
					<thead>
						<tr>
							<td></td>
							<td>#</td>
							<td class="td-medium">Restaurant</td>
							<td class="td-medium">Name</td>
							<td>Amount</td>
							<td>Payment</td>
							<td class="td-medium">Date</td>
							<td></td>
							<td></td>
							<td></td>
						</tr>
					</thead>
{'fraction_non_alphanumeric': 0.21786596541557096, 'fraction_numerical': 0.001593752490238266, 'mean_word_length': 3.333563535911602, 'pattern_counts': {'":': 0, '<': 535, '<?xml version=': 0, '>': 535, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1219450', 'n_tokens_mistral': 5799, 'n_tokens_neox': 4515, 'n_words': 784}