Exemplo n.º 1
0
 protected void radGridAmountReceived_ItemDataBound(object sender, GridItemEventArgs e)
 {
     if (e.Item.ItemType == GridItemType.Item || e.Item.ItemType == GridItemType.AlternatingItem)
     {
         AmountReceived amt = (AmountReceived)e.Item.DataItem;
         ((GridDataItem)e.Item)["IsSetPaid"].Text = "No";
         if (amt.IsSetPaid)
         {
             ((GridDataItem)e.Item)["IsSetPaid"].Text = "Yes";
         }
         try { ((GridDataItem)e.Item)["User"].Text = "" + Administrator.GetAdministrator(amt.CommentatorID).LoginId + ""; }
         catch { }
     }
 }
Exemplo n.º 2
0
    protected void btnGo2_Click(object sender, EventArgs e)
    {
        Guid      payGroupId = new Guid(txtGroupId.Text);
        Guid      regId      = Guid.Empty;
        EntryList list       = EntryList.GetEntryList(payGroupId, Guid.Empty, ""); // contains the pay group id

        bool isChange = false;

        if (list[0].Invoice != "")
        {
            isChange = true;
        }

        string  invoice     = "";
        decimal totalamount = 0;

        foreach (Entry entry in list)
        {
            entry.Status    = StatusEntry.UploadPending;
            entry.PayStatus = StatusPaymentEntry.Paid;
            if (!isChange)
            {
                if (entry.Serial.Trim() == "")
                {
                    entry.Serial = GeneralFunction.GetNewOrderNumber(entry);
                }
                if (invoice == "")
                {
                    invoice = GeneralFunction.GetNewInvoiceNumber();
                }
            }
            else
            {
                invoice = entry.Invoice;
            }
            entry.Invoice = invoice;
            //entry.DateSubmittedString = DateTime.Now.ToString();
            //entry.Save();
            regId = entry.RegistrationId;
            //totalamount += GetEntryPrice(entry);
        }

        // update again for the amount to the 1st entry
        list[0].AmountReceived = totalamount;
        //list[0].Save();


        // Save a new amount received
        AmountReceived amt = AmountReceived.NewAmountReceived();

        amt.Amount             = totalamount;
        amt.DateReceivedString = DateTime.Now.ToString();
        amt.PaygroupId         = payGroupId;
        amt.Invoice            = invoice;
        amt.Remarks            = "Received from Paypal";
        amt.IsSetPaid          = true;
        amt.DateCreatedString  = DateTime.Now.ToString();
        //amt.Save();



        //Send Email
        Email.SendCompletedPaymentEmailPayPalChange(Registration.GetRegistration(regId), payGroupId, invoice); // payment group id

        GeneralFunction.UpdateEntryLastSendPaidEmailDate(payGroupId);
    }
Exemplo n.º 3
0
        private void metroButton1_Click(object sender, EventArgs e)
        {
            //Create Word Application
            word.Application wordApp = new word.Application();
            wordApp.Visible = true;

            //Create the Document
            word.Document wordDoc = wordApp.Documents.Add();

            //Create the Heading Parahraph
            word.Paragraph wordPara = wordDoc.Paragraphs.Add();
            wordPara.Range.Text = "End of Shift Report";
            object styleName = "Intense Quote";

            wordPara.Range.set_Style(ref styleName);
            wordPara.Range.InsertParagraphAfter();

            //Create a New Paragraph
            word.Paragraph wordPara2 = wordDoc.Paragraphs.Add();
            wordPara2.Range.Text = "This Document Contains all the crucial information regarding the Total Sales made per Shift. This information includes the Total Sales Made in the Shift, Each Sale made, their payment type and amounts. The total Amount of Sales Made this shift is: " + lblTotalSalesMade.Text + " " + "The Total Revenue made today is: R" + lblRevenue.Text;
            object styleName2 = "Subtle Emphasis";

            wordPara2.Range.set_Style(ref styleName2);
            wordPara2.Range.InsertParagraphAfter();


            int    PaymentID;
            double PaumentAmount;
            string PaymentDate;
            double PaymentVAT;
            double AmountReceived;
            double Change;
            int    PaymentTypeID;
            string Description;
            string Type;

            SqlConnection sqlcon = new SqlConnection(Globals.ConnectionString);

            sqlcon.Open();
            string        cmd    = "SELECT PaymentID, PaymentAmount, PaymentDate, PaymentVAt, AmountReceived, Change, PaymentTypeID FROM Payment WHERE PaymentDate ='" + lblDate.Text + "'";
            SqlCommand    sqlcom = new SqlCommand(cmd, sqlcon);
            SqlDataReader dr     = sqlcom.ExecuteReader();

            if (dr.HasRows)
            {
                while (dr.Read())
                {
                    PaymentID      = Convert.ToInt32((dr["PaymentID"]));
                    PaumentAmount  = Convert.ToDouble((dr["PaymentAmount"]));
                    PaymentDate    = (dr["PaymentDate"].ToString());
                    PaymentVAT     = Convert.ToDouble((dr["PaymentVAt"]));
                    AmountReceived = Convert.ToDouble((dr["AmountReceived"]));
                    Change         = Convert.ToDouble((dr["Change"]));
                    PaymentTypeID  = Convert.ToInt32((dr["PaymentTypeID"]));

                    if (PaymentTypeID == 1)
                    {
                        Type = "Cash Sale";
                    }
                    else
                    {
                        Type = "Credit Card Sale";
                    }

                    Details = "Payment ID: " + PaymentID.ToString() + "\n" +
                              "Payment Amount: R" + PaumentAmount.ToString() + "\n" +
                              "Payment Date: " + PaymentDate.ToString() + "\n" +
                              "VAT: R" + PaymentVAT.ToString() + "\n" +
                              "Amount Received: R" + AmountReceived.ToString() + "\n" +
                              "Change: R" + Change.ToString() + "\n" +
                              "Payment Type: " + Type.ToString() + "\n";


                    word.Paragraph wordPara3  = wordDoc.Paragraphs.Add();
                    object         styleName3 = "List Paragraph";
                    wordPara3.Range.set_Style(ref styleName3);
                    wordPara3.Range.InsertParagraphAfter();
                    wordPara3.Range.Text = Details;
                }
            }

            dr.Close();
            sqlcon.Close();
        }
Exemplo n.º 4
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        if (ValidateForm())
        {
            Guid entryId = new Guid(hldEntryId.Value);
            entry = Entry.GetEntry(entryId);

            // save the amount to the first entry or this default entry
            entry.AmountReceived += decimal.Parse(txtAmountRecieved.Text);
            entry.Save();


            // paid?
            bool      isPaid         = false;
            Guid      paymentGroupId = entry.PayGroupId;
            EntryList list           = EntryList.GetEntryList(paymentGroupId, Guid.Empty, "");
            foreach (Entry ent in list)
            {
                string paidstatus_org = ent.PayStatus;

                // Allow Upload - only if its not aleady pending complete or completed
                if (rblPayment.SelectedValue == "AllowUpload" && ent.Status != StatusEntry.UploadCompleted && ent.Status != StatusEntry.Completed)
                {
                    //if (rblPayment.SelectedValue == "AllowUpload")
                    //{
                    ent.Status = StatusEntry.UploadPending;
                    //}
                    //else
                    //{
                    //    ent.Status = StatusEntry.PaymentPending;
                    //}
                }

                // make the change only if the status has changed.
                // if not do not change it
                if (rblPayment.SelectedValue == StatusPaymentEntry.Paid /*chkPaid.Checked*/ && paidstatus_org == StatusPaymentEntry.NotPaid)
                {
                    ent.PayStatus = StatusPaymentEntry.Paid;

                    // set if its not aleady pending complete or completed
                    if (ent.Status != StatusEntry.UploadCompleted && ent.Status != StatusEntry.Completed)
                    {
                        ent.Status = StatusEntry.UploadPending;
                    }

                    isPaid = true;
                }

                //if (paidstatus_org == StatusPaymentEntry.Paid)
                //{
                //    ent.PayStatus = StatusPaymentEntry.NotPaid;
                //}


                // double check if paid then it must be allow upload
                if (ent.PayStatus == StatusPaymentEntry.Paid && ent.Status != StatusEntry.UploadCompleted && ent.Status != StatusEntry.Completed)
                {
                    ent.Status = StatusEntry.UploadPending;
                }

                ent.Save();
            }


            // send email? if sent before do not send any more
            string lastdatesent = GeneralFunction.CleanDateTimeToString(entry.LastSendPaidEmailDate, "dd/MM/yy HH:mm tt");
            //if (chkAllowUpload.Checked && lastdatesent == "")
            if (lastdatesent == "")
            {
                if (entry.PaymentMethod != PaymentType.PayPal)
                {
                    //if (IsAmountFullyPaidIncludeThisAmount())
                    if (rblPayment.SelectedValue == StatusPaymentEntry.Paid || IsAmountFullyPaidIncludeThisAmount())
                    {
                        // Full payment
                        GeneralFunction.CompleteNewEntrySubmissionOthers(paymentGroupId);
                    }
                    else if (rblPayment.SelectedValue == "AllowUpload")
                    {
                        // Partial payment
                        Email.SendCompletedPaymentEmailOthers(Registration.GetRegistration(list[0].RegistrationId), paymentGroupId, "");
                        GeneralFunction.UpdateEntryLastSendPaidEmailDate(paymentGroupId);
                    }
                }
            }


            Administrator admin = Security.GetAdminLoginSession();
            Registration  reg   = Security.GetLoginSessionUser();
            // history
            AmountReceived amt = AmountReceived.NewAmountReceived();
            amt.Amount = decimal.Parse(txtAmountRecieved.Text);
            DateTime datetime     = DateTime.Parse(dpDateReceived.DateInput.SelectedDate.ToString());
            string   Date         = datetime.ToString("MM/dd/yyyy");
            string   Time         = DateTime.Now.ToString("hh:mm tt");
            DateTime DateReceived = DateTime.Parse(Date + " " + Time);
            amt.DateReceivedString = DateReceived.ToString();
            amt.PaygroupId         = entry.PayGroupId;
            amt.Invoice            = "";
            amt.Remarks            = txtRemarks.Text;
            amt.IsSetPaid          = isPaid;
            amt.DateCreatedString  = DateTime.Now.ToString();
            if (admin != null)
            {
                amt.isAdmin       = true;
                amt.CommentatorID = admin.Id;
            }
            else
            {
                amt.isAdmin       = false;
                amt.CommentatorID = reg.Id;
            }
            amt.Save();



            if (Save_Clicked != null)
            {
                Save_Clicked(this, EventArgs.Empty);
            }
        }
    }